angular 父组件调用子组件方法

父组件TS代码:

<app-son #datepicker></app-son>
	@ViewChild('datepicker') datepicker: childComponent;
	refreshClick() {
		this.datepicker.clearTime();
	}

子组件TS代码:

	clearTime() {
		this.times = null;
	}
Logo

腾讯云面向开发者汇聚海量精品云计算使用和开发经验,营造开放的云计算技术生态圈。

更多推荐