Avoid to reload Controller on change page/$state

hey dudes :smile:

I’m with a little doubt/problem. Let me explain:

I have a function with an ajax request ($http). The function is triggered from a button (form). When the $http returns, I want to display the result in another view (like a master-detail). The detail view is just to present the result, so both view share the same Controller. The issue happens when the $http returns and I change the view dynamically, the new view shows nothing… :confused: This is cause the Controller is reloaded with the page change (is it?)…

here the fiddle

in this second fiddle, I just comment the $state.transitionTo, so we can check that the $http ajax request is working.

Can someone show me and teach me how to change the page without reload the Controller, so my wanted master-detail will work… or if you guys have a better way to do that…

thanks for your time!.. :blush:

Same here, have you found solution for this problem?

Hi @Bobby , sorry for delay. I avoid this problem managing the error before of the page change, if I get an error I don’t change the page, if is all ok I change the page to the details.

But the Ionic now have a new feature that is to cache the pages. Have you tried it?

Yep, solved with cache :slight_smile: Thanks