Angular - Dynamic component in mat-tab
问题 I have a mat-tab-group (angular material) and I want to be able to add from code behind mat-tabs including other components. I am using ComponentFactoryResolver to create the component but I am not able to add the new component to the new mat-tab through the ViewContainerRef html <mat-tab-group> <mat-tab *ngFor="let tab of tabs" [label]="tab.title"> <div #test></div> </mat-tab> </mat-tab-group> code behind private open(type:string):void{ var tab = {title:'test'}; this.tabs.push(tab); const