Components: MatTab: selectedTabChange should not fire when the tab is changed programmatically

Created on 6 Dec 2019  路  4Comments  路  Source: angular/components

There should be a way to differentiate between a UI and a programmaticcally induced tab change. As of now, both cause the selectedTabChange: EventEmitter to emit.

My case is pretty simple: I want to display the currently opened Tab in the URL:

somePage?openedTab=1
somePage?openedTab=2

But I also want the corresponding tab to open when a URL pointing to a specific tab is navigated to. Ideally, the [selectedIndex] input should not cause (selectedTabChange) to fire.

Does this make sense?

Material 8.2.3, Angular 8.2.11

P3 materiatabs feature

Most helpful comment

will this be fixed ? i think is a bug, not a feature request ...
especially when an input binding (selectedIndex) change results in firing of both selectedTabChange and selectedIndexChange

https://stackblitz.com/edit/angular-mat-tab-group-outputs?file=src/app/tab-group-basic-example.ts

thanks 馃憤

All 4 comments

Sounds like a reasonable feature request to me. Native elements (such as input) do not emit on programmatic changes either, so we should definitely match that.

https://stackblitz.com/edit/comp-17889?file=src/app/app.component.html

will this be fixed ? i think is a bug, not a feature request ...
especially when an input binding (selectedIndex) change results in firing of both selectedTabChange and selectedIndexChange

https://stackblitz.com/edit/angular-mat-tab-group-outputs?file=src/app/tab-group-basic-example.ts

thanks 馃憤

Any news here?

Interested on an update on this one as well

Was this page helpful?
0 / 5 - 0 ratings

Related issues

vanor89 picture vanor89  路  3Comments

RoxKilly picture RoxKilly  路  3Comments

kara picture kara  路  3Comments

michaelb-01 picture michaelb-01  路  3Comments

LoganDupont picture LoganDupont  路  3Comments