我有两个组件,例如:StudentComponent,viewstudentcomponent
使用ngbmodal打开来自Student组件的viewstudent组件,并传递来自Student组件的数据。
但是值未绑定到viewstudent组件中。当从viewstudentcomponent本身打开模式时,值绑定。
我的代码:
openstudentUser(data) {
const modalRef = this.modal.open(ViewStudentComponent,{centered:true});
modalRef.componentInstance.FirstName= "Lilly";
}
ViewStudentComponent:
this.studentForm = this.formbuilder.group({
FirstName: [this.FirstName, [Validators.required]],
LastName: ["", [Validators.required]
});