doubleya
doubleya

Reputation: 539

$scope.$apply returning error

Running into an issue here. I have an ng-repeat on my page which is displaying data coming from my rest api that i've set up. I have a delete button on each of my products, when I delete, the item actually goes away (and when i refresh I can see that) but I'm trying to have the article delete off the page at the time delete is clicked (without refreshing). I've tried using $scope.$apply() as well as following the response from this Angular JS : $Scope.Apply() but still no luck. Using $scope.$apply() just gives me an error:

Error: [$rootScope:inprog] http://errors.angularjs.org/1.4.4/$rootScope/inprog?p0=%24apply

Any ideas?

Upvotes: 0

Views: 190

Answers (1)

Hysterix
Hysterix

Reputation: 11

Without seeing your code, I'm assuming you're removing the item using your service, but not updating the array of items bound to your ng-repeat. You should probably avoid the $scope.$apply() unless you're performing actions that would usually be out of sync with the digest cycle.

Upvotes: 1

Related Questions