如何访问孙子组件?
例如,我有一个grandparent.component.ts、parent.component.ts和child.component.ts。child.component.ts在其模板中有一个按钮列表。parent.component.ts包含child.component.ts。grandparent.component.ts包含parent.component.ts。我想在grandparent.component.ts中禁用child.component.ts中的按钮。如何做到这一点?
ChildComponent
交互而不是首先通过ParentComponent
传递,则我只能想到通过ElementRef访问它并手动更改属性。不过这种方法解决方案非常粗糙。 https://plnkr.co/edit/CfspDAbXHhSi7COsO9Lt?p=preview - Adrian