angularjs - How to reflesh $scope in Angular in AJAX reponse? -


i have ajax response inside deleted object:

request.success(function (data) {     delete $scope.notifications.system[key];     $scope.$apply(); }); 

i have html code block, appear condition:

<span ng-show="notifications.system.length == 0" ng-cloak> deleted </span> 

so, tried use $scope.$apply(); in response @ once after removing object. have got error:

error: [$rootscope:inprog] http://errors.angularjs.org/1.3.13/$rootscope/inprog?p0=%24digest 

how can reload template when notifications.system.length equal zero?

when use delete on arrays doesn't change length of array instead replaces element in array undefined. ng-show never changes because length of array isn't changing. use splice instead , array shorten , $scope should update @ expect.

$scope.notifications.system.splice($scope.notifications.system.indexof(key), 1); 

you shouldn't need $scope.$apply() this.


Comments

Popular posts from this blog

javascript - Bootstrap Popover: iOS Safari strange behaviour -

Magento/PHP - Get phones on all members in a customer group -

session - Logging Out Using PHP -