javascript - $route.reload(); Issue -


hi im currenty using $route.reload refresh content of controller every time update database. problem when updating huge list of data, every time update database , run $route.reload browser lose ability scroll or down browser, works fine smaller list of data.

below sample of code

$scope.undone = function(id){     $scope.index =  $scope.getid ;      crud.put('/undojda/'+$scope.index).then(function(response){                      toastr.info('jda has been activated.', 'information');     $route.reload();     }); } 

your best bet sort of lazy loading/pagination. in case it's large list, in tenths of thousands, might dom rendering problem. also, if isn't case, should try using angularjs's bind once(available since 1.3), track not create watcher each object on scope, in template. assuming using ngrepeat, let's this:

...<ul>     <li ng-repeat="item in items">       <b>{{item.name}}</b>     </li>    </ul> 

change following, in case data not update often:

...<ul>     <li ng-repeat="item in items track $index">       <b>{{::item.name}}</b>     </li>    </ul> 

as side note, try have dot in model's name. $scope.something.list, eaxample. ("if don't have dot, doing wrong" - misko hevery himself said this.).


Comments

Popular posts from this blog

tcpdump - How to check if server received packet (acknowledged) -