我想打印容器的索引
我试着写
{{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]);
}
}