调用根组件的方法,我在我的应用程序几个组件:角2:嵌套的子组件
//.ts:
RootComponent
-ParentComponent
--ChildComponent
---LastLevelComponent
//.html
<root-component>
<parent-component>
<child-component>
<last-level-component></last-level-component>
</child-component>
</parent-component>
</root-component>
我想打电话给Rootcomponent从LastLevelComponent的方法。
我知道EventEmitter,但问题是我需要将 值传递给每个子组件。 有没有什么办法可以直接调用 从LastLevelComponent RootComponent的方法,而不是 依赖于ParentComponent或ChildComponent。