Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular 4 how do I disable tab navigation in an angular material tab group?

<md-tab-group>
  <md-tab label="Tab 1">Content 1</md-tab>
  <md-tab label="Tab 2">Content 2</md-tab>
</md-tab-group>

I have a tab-group but I don't want the user to be able to change to the next form without filling the required controls first. Instead, I would like the user to only be able to navigate using a next and back buttons that I will enable disable based on validation.

like image 738
John Miller Avatar asked Mar 05 '26 07:03

John Miller


1 Answers

I would do it by using the following css

::ng-deep .mat-tab-label {
   pointer-events: none;
}

Plunker Example

like image 116
yurzui Avatar answered Mar 06 '26 23:03

yurzui



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!