javascript - Ng-repeat rendering entire list from the beginnning after appending items to it -
i implementing infinite-scrolling using angular. when user reaches end of scroll, new data fetched using ajax call, , appended existing list. here relevant code:
function gets called on successful completion of ajax call:
function successcallback(data){ var scope = angular.element($("#splistroot")).scope(); scope.$apply(function(){ if(scope.providerslist === null) { scope.providerslist = []; /* init if null */ } array.prototype.push.apply(scope.providerslist, json.parse(data.serviceproviderlist)); scope.servicename = data.category; scope.limit += search_limit; viewtobedisplayed(list_view); }) setevents(); if (a.onscreen(listenddiv,10)) { getmoredataend(); } }
html part:
<div id="spn-service-provider-list"> <div ng-repeat="providerslist in ( filteredproducts = ( providerslist | filter:{ providername: spsearch } | filter:{ citiesservicing: locationsearch }:ignorenullcomparator )) | orderby: 'rank' | limitto: limit" > ...... .......
the problem facing ng-repeat rendering entire list starting, each time successcallback() called. want show appended data, websites do. there solution this?
thanks!
wiki
Comments
Post a Comment