Skip to content

Instantly share code, notes, and snippets.

@zenius
Created June 18, 2019 13:16
Show Gist options
  • Save zenius/7a98500eb5c92528483e90cdbb45aa89 to your computer and use it in GitHub Desktop.
Save zenius/7a98500eb5c92528483e90cdbb45aa89 to your computer and use it in GitHub Desktop.
https://www.tutlane.com/tutorial/angularjs/angularjs-apply-function
$scope.$apply(function () {
//Your Code.
});
Different ways to use '$apply()'
1.
$scope.$apply(function () {
$scope.val1 = 'tutlane.com';
});
2.
$scope.$apply('val1 = "tutlane.com"');
3.(Recommended)
$scope.$apply(function (scope) {
scope.val1 = 'tutlane.com';
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment