加载子组件时,我需要将一组值传递给父组件。不确定我做错了什么。任何帮助将不胜感激。
这是“数据类”
parent.component.ts 包含这个函数:
child.component.ts 看起来像这样:
问题是你不能在类的主体中调用emit。您需要在方法或生命周期内调用它。所以在你的情况下最有可能有效的是
ngOnInit(){ this.updateParent.emit(dbButtons) }