diff options
| author | Igor Minar | 2011-06-06 08:50:35 -0700 |
|---|---|---|
| committer | Igor Minar | 2011-06-06 22:52:02 -0700 |
| commit | 7f1e2e48467f80cc083d24b44f088620e4e7bcb6 (patch) | |
| tree | 731a91366c5780985be6d4c5ddbe34e307d5cb70 /docs/content/guide/dev_guide.scopes.controlling_scopes.ngdoc | |
| parent | 5533e48dead5cff3107e72ee80bf0f19df77c1e9 (diff) | |
| download | angular.js-7f1e2e48467f80cc083d24b44f088620e4e7bcb6.tar.bz2 | |
new batch of docs
Diffstat (limited to 'docs/content/guide/dev_guide.scopes.controlling_scopes.ngdoc')
| -rw-r--r-- | docs/content/guide/dev_guide.scopes.controlling_scopes.ngdoc | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/docs/content/guide/dev_guide.scopes.controlling_scopes.ngdoc b/docs/content/guide/dev_guide.scopes.controlling_scopes.ngdoc new file mode 100644 index 00000000..ca63cbc3 --- /dev/null +++ b/docs/content/guide/dev_guide.scopes.controlling_scopes.ngdoc @@ -0,0 +1,50 @@ +@workInProgress +@ngdoc overview +@name Developer Guide: Scopes: Applying Controllers to Scopes +@description + + +When a controller function is applied to a scope, the scope is augmented with the behavior defined +in the controller. The end result is that the scope behaves as if it were the controller: + + +<pre> +var scope = angular.scope(); +scope.salutation = 'Hello'; +scope.name = 'World'; + + +expect(scope.greeting).toEqual(undefined); + + +scope.$watch('name', function(){ +this.greeting = this.salutation + ' ' + this.name + '!'; +}); + + +expect(scope.greeting).toEqual('Hello World!'); +scope.name = 'Misko'; +// scope.$eval() will propagate the change to listeners +expect(scope.greeting).toEqual('Hello World!'); + + +scope.$eval(); +expect(scope.greeting).toEqual('Hello Misko!'); +</pre> + + + + +## Related Topics + + +* {@link dev_guide.scopes Angular Scope Objects} +* {@link dev_guide.scopes.understanding_scopes Understanding Angular Scopes} +* {@link dev_guide.scopes.working_scopes Working With Angular Scopes} +* {@link dev_guide.scopes.updating_scopes Updating Angular Scopes} + + +## Related API + + +* {@link api/angular.scope Angular Scope API} |
