E.g. i use default ionic app “tabs”.
So for the “home” tab i have this code in the controller:
.controller('DashCtrl', function($scope) {
$scope.news = "Loading...";
$http.get('http://data.com/news').success(function(data){
$scope.news = data;
})
})
html code looks like this:
<ion-view title="Dashboard">
<ion-content class="padding">
<h1>Dash</h1>
<p>{{news}}</p>
</ion-content>
</ion-view>
So when I’m visiting “home” tab after little amount of time I see result of $http request.
Then I’m going to the “Account” tab.
And then I’m going back to “home” tab again.
But I’m don’t see news that was loaded few moments ago !
I see text “Loading…” and again after few seconds news loads again.
How can i prevent this ?