Created
August 15, 2015 05:05
-
-
Save vreality64/562871329460010dc555 to your computer and use it in GitHub Desktop.
AngularJS and scope.$apply example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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