📜  ngfor 的 viewchild - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:02:21.710000             🧑  作者: Mango

代码示例1
------------------------- import { ViewChildren, QueryList } from '@angular/core'; /** Get handle on cmp tags in the template */ @ViewChildren('cmp') components:QueryList; // or ElementRef if only need to grab element ngAfterViewInit(){ // print array of CustomComponent objects console.log(this.components.toArray()); }