Skip to content

Instantly share code, notes, and snippets.

@vreality64
Created August 15, 2015 05:05
Show Gist options
  • Save vreality64/562871329460010dc555 to your computer and use it in GitHub Desktop.
Save vreality64/562871329460010dc555 to your computer and use it in GitHub Desktop.
AngularJS and scope.$apply example
function Ctrl($scope) {
$scope.message = "Waiting 2000ms for update";
setTimeout(function () {
$scope.$apply(function () { // wrapping using $scope.$apply
$scope.message = "Timeout called!";
});
}, 2000);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment