我有一个ts文件app.component.ts,其中有一个布尔变量"flag",我创建了一个名为dialog的组件,我的需求是从dialog.ts设置来自app.component.ts的变量。
我看到可以通过EventEmitter实现这一点,但不知何故对我不起作用。
@Output() selectionDialogEvent=new EventEmitter<boolean>();
this.selectionDialogEvent.emit("true");
在父级中,我正在尝试
getSelectionDialogEvents($event){
console.log("Event received"+$event);
this.chat=flag;
}