• $scope is an object that refers to the app model

  • $scope provides the execution context for expressions

  • $scope is the glue between the controller and the view

  • $scope can watch expressions and propogate events

  • Attach properties / functions to scope to make them available to the view

  • Any objects or primitives that is added to the $scope are considered model properties

  • $scope are arranged in hierarchical structure

 


AngularJS - Understanding $scope

  • Child scopes prototypically inherit

  • JavaScript Prototypical Inheritance : If it doesn’t exist in current, it will go up the chain ( parent ). Hiding and shadowing of properties.

  • Best practice of always have a “.” in model


AngularJS - $scope : Adding Behavior

  • Business logic in the controller means exposing functions or reacting to events

  • Append properties or methods to the $scope

  • These methods need to be exposed to the view