Angularjs Examples

AJS Examples


AngularJS Scope Methods

AngularJS scope is an object treated as application model and execution context for expressions. Scopes are arranged in hierarchical structure which mimics the DOM structure.

Scope Characteristics

  • Scopes object provides APIs like $watch, $watchgroup, $watchCollection etc to observe model changes.
  • $watch method is used for watching single scope properties.
  • $watchCollection() method is used for watching a scope property of collection in nature like Array.
  • $watchGroup() method is used for watching a group of scope properties in AngularJS application.

AngularJS Scope Methods

Here is a list of AngularJS Scope Methods with description.

MethodDescription
$watch This method is used to watch value changes in scope properties or variables.
$watchGroup This method is used to watch value in scope array variable.
$watchCollection This method is used to observe properties on a single object.
$on This method is used to listens dispatched events of a given type
$emit This method is used to dispatches an event name upwards and travel up to $rootScope.scope listeners.
$broadcast This method is used to dispatches an event name downward to all child scopes notify the registered $rootScope listeners.
$new This scope object method creates a new child scope.
$digest This scope method processes all of the watchers of the current scope and its children.
$eval This scope method is used to executes the expression on the current scope and returns the result.
$apply This scope method is used to execute an expression in angular from outside of the angular framework.