在列表组件中,我想渲染多个细节组件.
list.component.ts
@Component({ selector: 'detail',templateUrl: './detail.component.html' }) export class DetailComponent { @ViewChild('details') details; public items = { // ... } }
list.component.html
<detail *ngFor="let item of items" #details></detail>
注意#details tempalte引用变量.我想访问所有细节组件.可以将#details变量设为数组吗?