Skip to content

Instantly share code, notes, and snippets.

@coldhawaiian
Last active January 4, 2016 20:49
Show Gist options
  • Save coldhawaiian/8677126 to your computer and use it in GitHub Desktop.
Save coldhawaiian/8677126 to your computer and use it in GitHub Desktop.
AngularJS Scope Notes

Helpful links for Angular element.$on, and $scope.$watch, $digest, and $apply:

Note: Ben Lesh doesn't recommend using $apply in a controller, but in a directive or service instead.

Also helpful:

When the browser calls into JavaScript the code executes outside the Angular execution context, which means that Angular is unaware of model modifications. To properly process model modifications the execution has to enter the Angular execution context using the $apply method. Only model modifications which execute inside the $apply method will be properly accounted for by Angular.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment