Reputation: 1
I am developing an ionic app which allow every user to see all his places and the places he's invited to, provided he clicks on the "My Places" tab. The problem is whenever I open the tab I have to refresh the data by calling API. What I tried to do is to trigger the scope responsible for fetching the data every time he add a place, delete a place, or he's invited to a place. For example, if he add a place, I emit this $rootScope.$emit("RefreshPlaces", {});
and in "My Places" controller I have
$rootScope.$on('RefreshPlaces', function() {
$scope.getPlaces();
});
The problem I encountered is that "My places" controller sometimes isn't loaded and thus don't receive the event and we see nothing on "My places" tab ( empty page ). The reason I did all that is because the app become slow and it makes no sense to fetch data every time a user click on the tab.
Furthermore, I noticed while using Facebook and Quora that the naviguation between tabs don't always fetch data from server.How does Quora or Facebook knows when to fetch data and when not ?
Upvotes: 0
Views: 241