angularjs - when to use $scope.$apply in angular -
i little confused how $scope.$apply
, digest loops
function. understand, since digest loops runs @ regular intervals , not always, can force digest loop run on scope variables want update immediately. in description here, it's given $scope.$apply
should used when async call
made, variables can updated. doubt if digest loop doesn't run always, how scope variables instantaneously updated in view/controller
?
simply, use $scope.$apply()
whenever you're outside angular scope. example within settimeout function, outside world of angular.
Comments
Post a Comment