bug: for the cached pages provide a way to reinvoke controller
Type: bug
Platform: all
Hello.
Some of the nice features don't work without using cached pages. However when you transition b\w cached pages - controller of the page is not initiated.
Is it possible for you guys provide a solution so that when you transition to the cached page - there is an event or something that can be triggered to update the data? Otherwise swipe buck functionality is useless for 99% of the use cases.
I'm not sure if it's exactly what you are looking for but why aren't you using the ionic-view lifecycle-events: http://ionicframework.com/docs/api/directive/ionView/
For example if you want to update the data-scope whenever you load a fresh or cached view you could simply add the following to you controller:
// update scope whenever the view is shown
$scope.$on('$ionicView.afterEnter', function() {
DataService.loadData().then(function(data) {
$scope.data = data;
});
});
Thanks... Elvis? :)
it actually sounds like a very good idea that can help to enable caching across the application and still reload data. Enabling caching would benefit UX and helps us to add swipe back functionality back again
Let me try that but that's for the hint, i thought afterEnter would not work with swiping b\w cached pages for some reason!
Just gave it a try. Looks like it's still not stable and not working for most of the people. I had exactly the same issue as those guys http://forum.ionicframework.com/t/ionicview-in-scope-on-not-launching/15847/2
doesn't launch any of those events for the scope. Does for rootScope but in an unpredictable way....
Caching views, being what they are, would not reinit. You can turn off caching, or listen for the $ionicView events. It sounds like the events aren't firing consistently for you though. Could you provide a codepen or something we can look at and inspect to help figure out why they're not firing?
is there anywhere a codepen with a working events on the cached pages? Would be easier to look at working implementation, I don't have anything unusual, caching enabled for all application and listeners on page A. When I swipe back from page B listeners are not invoked even though transition works fine. 2 pages 2 controllers, that's all. I think having a code pen for this feature provided by ionic would benefit the users, otherwise we don't know if it's even works
I'll provide an example later today
if you want to reload controller when you come back into him , you need to clear cache immediately afterwards leaving it:
$scope.$on("$ionicView.afterLeave", function () { $ionicHistory.clearCache(); });
reviyou
http://noanavaro.de/dragon_opcion
21.03.2015, 00:44, "reviyou" [email protected]:I'll provide an example later today
—Reply to this email directly or .
To summarize:
1.If you want to enable swipe to go back you need ALL you pages, where you can go back, not just some pages. 2.basically on those those pages you might want to update the data. You have 2 options:
2.a do it from the child scope when you are still on the child page 2b expect to be able to go back and enter beforeEnter or afterLeave event where you can update you data for the current page
Looks like for now only the 2a option works properly but it is not very clean and convenient in terms of coding coding.
2a option has some issues and doesn't work consistently for some of the users (see link above and my original comment)
@PedroJusto Idea of cleaning the whole cache when you return to the parent page just smells. It's kind of against the purpose of having cache in the first place. Besides if you do it and remove the cache you swipe to go back functionality will suffer. That's part of the reason swipe to go back doesn't work with not cached pages currently - UX is ugly
Hello! Are you all still experiencing this issue?
Hello! Thanks for opening an issue with us! Since it has been a little while since there was any activity on this issue i will be closing it, but feel free to respond back if your still having the issue! Thanks again!