2016-11-26 106 views
8

可變我有兩個組成部分:列表和詳細信息角2模板引用與* ngFor

列表組件我要渲染多個細節成分

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參考變量。我想訪問所有的細節組件。有可能使#細節變量數組?

回答