使用ViewChild来获取组件实例,并使用该实例的方法。
index = 0;
@ViewChild(NzCarouselComponent, { static: false }) myCarousel: NzCarouselComponent;
goTo() {
this.myCarousel.goTo(Number(this.index));
}
Run Code Online (Sandbox Code Playgroud)
https://stackblitz.com/edit/angular-6rsuzz?file=src/app/app.component.ts
| 归档时间: |
|
| 查看次数: |
658 次 |
| 最近记录: |