1
https://angular.io/docs/ts/latest/cookbook/component-communication.html#!#parent-to-view-child調用子組件的方法,如果父母有相同的成分
所以要根據「官方」文檔的兩個孩子,子組件的調用方法可以父類中使用來完成:
@ViewChild(CountdownTimerComponent)
private timerComponent: CountdownTimerComponent;
,做
timerComponent.methodName()
那麼,如果父組件使用兩個CountDownTimerComponent,只想要調用timerComponentNumber1.methodName()?
假設開發人員要調用父類中的方法,而不是從模板
好的,等等,讓我試試看 – anaval