Search code examples
angularangular-materialangular-animationsmat-tablemat-tab

mat-tab transition triggers other animations in angular material table with expandable rows


I have a screen with mat-tab-group and one tab contains a table with expandable rows, those rows will be expanded only if click on it, but issue here is it will expand all rows automatically if we change the tab and come back . What is wrong here. ? enter image description here

This will show correctly for the first time then

enter image description here

it will expand all rows

enter image description here

Links : StackBlitz sample


Solution

  • Okay this is because , I have to wrap mat-tab contents by

    <ng-template matTabContent> //your content goes here </ng-template>

    Here is a working solution : https://stackblitz.com/edit/angular-yeveze?file=src/app/table-expandable-rows-example.html