javascript - show spinner while loading new feeds -


how show spinner while waiting news feeds loaded in ionic?

.controller('feedsctrl',['$scope','$http',function($scope,$http){     $http.get('http://example.com/feeds.php').success(function(data){            $scope.feeds=console.log(data) ;            $scope.feeds=data;             $scope.numberofitemstodisplay = 5; // use limit in ng-repeat     $scope.addmoreitem = function(done) {         if ($scope.feeds.length > $scope.numberofitemstodisplay)             $scope.numberofitemstodisplay += 5; // load number of more items             $scope.$broadcast('scroll.infinitescrollcomplete')     }  

html

<ion-infinite-scroll on-infinite="addmoreitem()" distance="1%"   ng-if="feeds.length > numberofitemstodisplay"> </ion-infinite-scroll> 

your spinner directive (assuming have one) should have ngshow/nghide/ngif attached boolean variable preferably in service, in $scope aswell (or $scope.$on event broadcast somewhere). should toggle variable true before starting load feed , toggle false once it's been loaded.


Comments

Popular posts from this blog

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -