angularjs - avoid consistently fetching data when clicking an a tab -
i developing ionic app allow every user see places , places he's invited to, provided clicks on "my places" tab. problem whenever open tab have refresh data calling api. tried trigger scope responsible fetching data every time add place, delete place, or he's invited place. example, if add place, emit $rootscope.$emit("refreshplaces", {});
, in "my places" controller have
$rootscope.$on('refreshplaces', function() { $scope.getplaces(); });
the problem encountered "my places" controller isn't loaded , don't receive event , see nothing on "my places" tab ( empty page ). reason did because app become slow , makes no sense fetch data every time user click on tab.
furthermore, noticed while using facebook , quora naviguation between tabs don't fetch data server.how quora or facebook knows when fetch data , when not ?
Comments
Post a Comment