調用根組件的方法,我在我的應用程序幾個組件:角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。