我有这个变量,它控制对话框是否显示,它在第一次工作,但不是在第二次工作,发出执行但不再调用接收函数。
父类:
isLogin :boolean ;
constructor(...){
this.isLogin = false;
}
receiveNotification(notification: boolean): void {
this.isLogin = notification;
}
父 html:
<login-dialog *ngIf="!isLogin" name="{{name}}" (notify)="receiveNotification($event)"></login-dialog>
在子类中:我有一个函数,当触发调用发出和发出确实被调用时,它不会第二次触发父级上的函数
@Output() notify = new EventEmitter<any>();
exampleFunction(){
this.notify.emit(true);
}
我想这可能与 ngIf 相关,但不确定,这里有什么问题?