我的父组件使用 ngSwitch 案例调用子组件:
<div *ngSwitchDefault>
<app-child-comp (toggleHelp)="toggleHelp($event)"></app-child-comp>
</div>
在子组件中:
@Output() toggleHelp = new EventEmitter();
this.toggleHelp.emit(true);
在父组件中:
toggleHelp() {
console.log('event fired');
}
至今没有成功。如果我在没有 的情况下调用组件ngSwitch
,那么它可以正常工作。任何帮助,将不胜感激。