2011-06-06 15:50:35 +00:00
|
|
|
@workInProgress
|
|
|
|
|
@ngdoc overview
|
2011-03-23 16:33:29 +00:00
|
|
|
@name Developer Guide: Scopes
|
2011-06-06 15:50:35 +00:00
|
|
|
@description
|
|
|
|
|
|
|
|
|
|
|
2011-03-23 16:33:29 +00:00
|
|
|
An Angular scope is a JavaScript object with additional APIs useful for watching property changes,
|
|
|
|
|
Angular scope is the model in Model-View-Controller paradigm. Instances of scope serve as the
|
|
|
|
|
context within which all {@link dev_guide.expressions expressions} get evaluated.
|
2011-06-06 15:50:35 +00:00
|
|
|
|
2011-03-23 16:33:29 +00:00
|
|
|
You can think of Angular scope objects as the medium through which the model, view, and controller
|
|
|
|
|
communicate. Scopes are linked during the compilation process with the view. This linkage provides
|
|
|
|
|
the contexts in which Angular creates data-bindings between the model and the view.
|
2011-06-06 15:50:35 +00:00
|
|
|
|
2011-03-23 16:33:29 +00:00
|
|
|
In addition to providing the context in which data is evaluated, Angular scope objects watch for
|
2011-06-06 15:50:35 +00:00
|
|
|
model changes. The scope objects also notify all components interested in any model changes (for
|
|
|
|
|
example, functions registered through {@link api/angular.scope.$watch $watch}, bindings created by
|
|
|
|
|
{@link api/angular.directive.ng:bind ng:bind}, or HTML input elements).
|
|
|
|
|
|
2011-03-23 16:33:29 +00:00
|
|
|
Angular scope objects:
|
2011-06-06 15:50:35 +00:00
|
|
|
|
2011-03-23 16:33:29 +00:00
|
|
|
* Link the model, controller and view template together.
|
|
|
|
|
* Provide the mechanism to watch for model changes ({@link api/angular.scope.$watch}).
|
|
|
|
|
* Notify interested components when the model changes ({@link api/angular.scope.$eval}).
|
|
|
|
|
* Provide the context in which expressions are evaluated.
|
2011-06-06 15:50:35 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
## Related Topics
|
|
|
|
|
|
|
|
|
|
* {@link dev_guide.scopes.understanding_scopes Understanding Scopes}
|
2011-03-23 16:33:29 +00:00
|
|
|
* {@link dev_guide.scopes.internals Scopes Internals}
|
2011-06-06 15:50:35 +00:00
|
|
|
|
|
|
|
|
## Related API
|
|
|
|
|
|
|
|
|
|
* {@link api/angular.scope Angular Scope API}
|
|
|
|
|
|