从子组件调用父组件中的函数时出现错误。我认为我在从父级调用func()
时在子级组件中犯了一些错误
parent component
func(){...........}
parent.html
<child (func)="func()"></child>
child.component.ts
@Output func = new EventEmitter();
someOtherFunc(){
this.func.emit();
}
答案 0 :(得分:0)
尝试一下,
parent.component.html
<child (func)="func($event)"></child>
child.component.ts
@Output() func: EventEmitter<any> = new EventEmitter();
someOtherFunc(){
this.func.emit(null);
}