简体   繁体   中英

$digest already in progress

I'm fetching the data using $http.get() and passing it as argument to a custom filter to get the filterd data. But it is giving an error: $digest already in progress .

Does anyone know how to avoid this error or achieve the same thing but a different way?

 var map=angular.module('map', []) .controller('mapCtrl', function ($scope,$filter,$http) { $http.get('./json/integrated.json').success(function(data) { $scope.sitesInfo = data; }); var filteritems= $filter('applySfotwareFilter')($scope.sitesInfo); }); 

I think you should place

var filteritems= $filter('applySfotwareFilter')($scope.sitesInfo);

inside your success function;

What happens is the filtering starts before your data is ready.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM