-
Notifications
You must be signed in to change notification settings - Fork 13.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Not all View life cycle events firing for tabs #2869
Comments
+1 on this bug - would appreciate a fix or potential work around if available. |
+1 |
+1 |
This fix doesn't seem to work for me. I created a new app using the tabs starter and under the 'FriendsCtrl' I added a series of $scope.$on('$ionicView.enter', ....) functions that logs enter, leave, beforeLeave, afterLeave for both $ionicView and $ionicNavView. Besides using the latest nightly, this is the only change I made to the template (I'll mention I also use Crosswalk). When I click the friends tab, I get events firing as follows from the code in the FriendCtrlr: The NavView leaves fire inside the FriendCtrlr, not the previous controller. I looked at the code referenced in the fix and the change to ViewSwitcher.js seems problematic. Within the emit function, scope is immediately assigned to the 'enteringEle.scope'. The code that was added to the function uses that same scope to emit the NavView leaves... thereby causing the NavView leaves to be emitted in the wrong controller? Here's a codepen with what I'm talking about... |
Still having the problem nightly |
Agree - problem still persists and @madgrizzle made a good explanation of what the root cause appears to be. |
This fix fires the Leave events in the leaving controller but still fires the NavLeave events in the arriving controller (still that issue with the ViewSwitcher.js change in 9cc61ec) |
Issue still not fixed for me... |
Seeing this as well |
Wow, I was very very anxious about this bug I just noticed this morning. Basically I have a view on Tab A.
When I simply go back (in the same tab, assuming I was forward in the history), it works, the alert is shown. However, if I DIRECTLY click on tab B, the callback is not called: no alert. Any idea @mhartington @adamdbradley ? Thanks ;) |
@adamdbradley @mhartington , I've found the use case that reproduces the bug. Working scenario: Buggy scenario: That's the whole of my issue since I need to trigger this leave event from a deep view (meaning forward in the tab's views' history) . Thus the key point is the tab's "history". A quick fix in the nightly (if possible) would be a gift ;) |
@adamdbradley @mhartington Sorry for all those (my) posts, but I found the real reason: So I have to deal with $scope.$on('$destroy') in order to make the job ;), typically called when the view is not cached. So in the official Ionic doc: It may help some developers, by checking whether their views are cached before dealing with the beforeLeave event while switching tabs. Thanks ! |
I have a similar possibly the same issue, All of the beforeEnter, enter, and afterEnter events fire however none of the beforeLeave, leave, or afterLeave events fire. However the $destory events do fire. |
Patrick http://thefitfactory.net/volatilnost 23.03.2015, 17:54, "Patrick Cauley" [email protected]:I have a similar possibly the same issue, All of the beforeEnter, enter, and afterEnter events fire however none of the beforeLeave, leave, or afterLeave events fire. However the $destory events do fire. —Reply to this email directly or . |
@mica16 In your demo, the |
mica16 http://sustainabletechknow.com/forum_webmoney 17.03.2015, 16:13, "mica16" [email protected]:Sorry for all those (my) posts, but I found the real reason: So I have to deal with $scope.$on('$destroy') in order to make the job ;) Therefore, it's not a bug. Thanks ! —Reply to this email directly or . |
I have this issue in ionic 1.0.0 |
Could you produce an example of this? |
I think I just faced the same issue: for leaving the whole tabs scope, the "beforeLeave" event is fired at the scope associated with the tabs, but not a detailed tab. Just tested on ionic lib 1.0.1 |
Just want to stress that everything in the view events is async, so they're really tough to pin point when exactly they happen. So even if they're being reported back as happening after another event, they really aren't. |
@mhartington I have a similar issue in nested view. Say a.b is abstract view, if I transition from state a.b.c to state a, '$ionic.beforeLeave' will only be fired on a.b state but not a.b.c. Is this a expected behavior? |
@orthocenter try using |
@mhartington: Tried your suggestion but that doesn't work. Basically, I've four tabs. I want to show a loader whenever tab is changed and hide it when the tab is loaded. While |
try enabling the cache view, it will work. it does not work when cache = false |
+1 Doesn't work when cache = false |
Was this problem ever fixed? Its happening for me on 1.3.1 For those getting annoyed, switching back to 1.3.0 seems to work. I didn't know a patch update was supposed to introduce breaking changes... |
I found a work around to this, have a look http://stackoverflow.com/questions/28938408/ionic-view-leave-events-never-called/42905435#42905435. Hope it helps! |
Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out. |
When changing tabs, certain view life-cycle events do not get executed.
http://codepen.io/mhartington/pen/qEqyBR
If you switch to the about tab, you'll get an alert from the beforeEnter event, but no alert form the beforeLeave event.
The text was updated successfully, but these errors were encountered: