[Tabs] Interrupt / Intercept tab change
See original GitHub issueBug, feature request, or proposal:
If possible, i want to intercept tab change, i know i have the MdTabChangeEvent
through MdTabGroup
’s selectChange
binding, but it only seems to show which tab is it transitioning to, how do i stop the transition of happening?
What is the expected behavior?
I want a way to call a function, make some logic in function and then if i want, stop the tab from happening, or even change to a different tab, my case is that the last tab should be a +
, and on click it should add a new tab instead of transitioning to that empty tab.
What is the current behavior?
Can’t find a way to intercept the transition of tabs.
What is the use-case or motivation for changing an existing behavior?
Using tabs for a step based process, or just having a +
tab made for the sole purpose of adding more tabs, not showing that tab.
Which versions of Angular, Material, OS, browsers are affected?
material@2.0.0-alpha.10
Is there anything else we should know?
Idk if it exists or it lacks the feature itself, i guess that for the moment i’ll need to let it transition to the empty tab, add the new tab and then transition to the created tab.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:19
- Comments:14 (4 by maintainers)
Top GitHub Comments
Slightly related to #2008, if we could bind to an EventEmitter output by the tab group which provides us the current tab, and the target tab, we would then probably only need a way to stop the index from changing.
@dlang117 Possible workaround can be found here
https://stackoverflow.com/questions/51354135/how-to-conditionally-prevent-user-from-navigating-to-other-tab-in-mat-tab-group/51354403#51354403