Angular Material Tab : Prevent tab change of mat-tab-group if the form in current tab is dirty

This solution is just a work around and has its flaws. It is mentioned below. Steps : In the template : Disable all tabs of the mat-tab-group <mat-tab label=”Tab 0″ disabled> Provide a click event handler on mat-tab-group. Also set the selectedIndex property using a variable from the component class. <mat-tab-group (click)=”tabClick($event)” [selectedIndex]=”selectedTabIndex”> In the … Read more