How to reuse HTML

18 views
Skip to first unread message

Srini

unread,
Jan 23, 2020, 4:02:58 AM1/23/20
to Angular and AngularJS discussion
Hi I have two tabs and both needs to display same content/template, where I am trying the below, but it renders (runs the components in content twice) twice whether I click tab1 or tab2. So any help about reusing html is appreciated.

<mat-tab-group >
<mat-tab label="Tab1">
<ng-container *ngTemplateOutlet="content"></ng-container>
</mat-tab>
<mat-tab label="Tab2">
<ng-container *ngTemplateOutlet="content"></ng-container>
</mat-tab>
</mat-tab-group>


<ng-template #content>
<app1></app2>
<app2></app2>
</ng-template>
Reply all
Reply to author
Forward
0 new messages