【发布时间】:2021-06-28 08:46:47
【问题描述】:
我在 Component1 中有一个对话框 Component2。当我在 Component2 中有一个 result = true 时,我想在 component1 中调用一个函数。
所以,我在Component1 中有这个代码:
searchbyenumber() {
const dialogRef = this.dialog.open(Component2, {
});
dialogRef.afterClosed().subscribe(result => {
if (result) {
this.LoadTrainingSessionPartecipants();
}
});
}
在 Component2 我有这个代码:
public dialogRef: MatDialogRef<Component2>
confirmYes() {
let Enrollment = new EnrollmentModel();
Enrollment.PersonId = PersonId.toString();
this.dataservice.SetEnrollment(Enrollment).then(
result => {
if (result) {
console.log('result11', result)
} else {
}
}
);
}
所以当我从这个函数 confirmYes() 得到结果为真时,我想执行 searchbyenumber() 函数 this.LoadTrainingSessionPartecipants() 我在 Component1 中的函数
请问您能告诉我如何称呼它吗?
【问题讨论】: