【发布时间】:2018-05-08 19:46:32
【问题描述】:
我要打印容器的索引
我尝试写
{{index}}但它不起作用
<ng-template #stepsClone >
<p>Paragraph {{index}} </p>
<input type="button" (click)="removeStep(index)" value="X" >
</ng-template>
export class AddInterviewComponent {
@ViewChild('stepsClone') template;
@ViewChild('stepsContainer', { read: ViewContainerRef }) container;
constructor(private resolver: ComponentFactoryResolver) { }
cloneStep() {
this.container.createEmbeddedView(this.template);
}
removeStep(index: any) {
this.container.remove(this.template[index]);
}
}
【问题讨论】: