You are modifying the scope outside of angular’s $digest
cycle 50% of the time.
If there is a callback which is not from angularjs; (posibbly jquery). You need to call $apply
to force a $digest
cycle.
But you cannot call $apply
while in $digest
cycle because every change you made will be reflected automatically already.
You need to know when the callback is not from angular and should call $apply
only then.
If you don’t know and not able to learn, here is a neat trick:
var applyFn = function () {
$scope.someProp = "123";
};
if ($scope.$$phase) { // most of the time it is "$digest"
applyFn();
} else {
$scope.$apply(applyFn);
}