-
Notifications
You must be signed in to change notification settings - Fork 3.4k
md-tab: md-on-select called on init #3243
Comments
this bug affects one of my apps also. I have routing events assigned to on-select, so now users can't open desired page by URL and I can't use $state.go, because right after that on-select will trigger another one redirect. |
This is probably due to this: #3169 . There is, however, still a bug in the latest version as the event is not coming when the tabs are loaded asynchronously. |
@jo-me funny thing is I completely disagree with you and don't think on-select should be fired when tab is initially displayed :) |
Nothing wrong with disagreeing :) IMO, as long as the md-tabs component automatically displays the first tab, the md-select event should get fired. |
@jo-me no, it triggers chaotic routing and ends up with "/#/" URL with default page rendered, so app is completely unusable (and I had to switch back to 0.9.8). I think separate event can satisfy both sides. |
I'm not familiar with your use case, but how about using the ng-click event instead? |
@jo-me good idea, thanks, but currently (with angular-material 0.10.0 and with 0.9.8, both) it gives exception about $apply: But I will glad to switch to ng-click, if this bug will be fixed. Especially when 0.10 is new stable :) |
I found solution: I just ignore first event and all works as expected. But I still hope ng-click bug will be fixed. |
@e-oz I believe ng-click should work, but I am not 100% sure what your use-case looks like. As for whether or not to fire the |
@robertmesserle I've created codepen with my use-case and with instruction how to reproduce bug: |
Ah, this is a separate issue, but I am committing a fix right now. |
@robertmesserle thank you! |
Using ng-click and @robertmesserle 's fix did indeed achieve the desired result. Thank you! |
Since about yesterday (0.10.0-rc4 ~ master branch), the
md-on-select
of anmd-tab
getsduring the initialization of
md-tabs
. Previously it has been called only when a tab was explicitly selected.Example - see console log
The text was updated successfully, but these errors were encountered: