【发布时间】:2017-09-17 19:07:11
【问题描述】:
https://angular.io/docs/ts/latest/cookbook/component-communication.html#!#parent-to-view-child
所以根据“官方”文档,子组件的调用方法可以在父类的内部使用:
@ViewChild(CountdownTimerComponent)
private timerComponent: CountdownTimerComponent;
做事
timerComponent.methodName()
那么如果父组件使用了两个CountDownTimerComponent并且只想调用timerComponentNumber1.methodName()呢?
假设开发者想要调用 ParentClass 内部的方法,而不是模板中的方法
【问题讨论】:
标签: angular typescript