我尝试仅在选择时显示标签内容:
<mat-tab label="contacts">
<p-contacts [contacts]="selectedPanel.contacts"
*ngIf="tabGroup.selectedIndex === 1">
</p-contacts>
</mat-tab>
这是工作,但我ERROR Error: ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked. Previous value: 'ngIf: false'. Current value: 'ngIf: true'.
知道了那么我做错了什么?
您可以通过使用如下属性将内容放入标签中来延迟加载选项卡的内容:ng-template
matTabContent
<mat-tab-group #tabGroup>
<mat-tab label="Firt">
<ng-template matTabContent>
Content 1
</ng-template>
</mat-tab>
<mat-tab label="Second">
<ng-template matTabContent>
Content 2
</ng-template>
</mat-tab>
<mat-tab label="Third">
<ng-template matTabContent>
Content 3
</ng-template>
</mat-tab>
</mat-tab-group>
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句