diff options
| author | andre | 2013-11-08 10:43:40 -0800 |
|---|---|---|
| committer | Pete Bacon Darwin | 2013-11-13 21:48:30 +0000 |
| commit | bee56a82b0375e10ade4cbca375489f7ebf59b0c (patch) | |
| tree | b97d88c04f645d23866c511dacbe5380d2ea82ff /docs/content/guide | |
| parent | bcdbfdfeae5ef16b603eece99aea73b94b5cc0db (diff) | |
| download | angular.js-bee56a82b0375e10ade4cbca375489f7ebf59b0c.tar.bz2 | |
docs(guide/scope): correct scopes example
Remove reference to `employee` property as it's not used in the example.
Inject and use `$rootScope` applying `department` property as mentioned in text.
Closes #4839
Diffstat (limited to 'docs/content/guide')
| -rw-r--r-- | docs/content/guide/scope.ngdoc | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/docs/content/guide/scope.ngdoc b/docs/content/guide/scope.ngdoc index c59f4009..b765d969 100644 --- a/docs/content/guide/scope.ngdoc +++ b/docs/content/guide/scope.ngdoc @@ -126,14 +126,15 @@ a diagram depicting the scope boundaries. </div> <div ng-controller="ListCtrl"> <ol> - <li ng-repeat="name in names">{{name}}</li> + <li ng-repeat="name in names">{{name}} from {{department}}</li> </ol> </div> </div> </file> <file name="script.js"> - function GreetCtrl($scope) { + function GreetCtrl($scope, $rootScope) { $scope.name = 'World'; + $rootScope.department = 'Angular'; } function ListCtrl($scope) { @@ -153,7 +154,7 @@ a diagram depicting the scope boundaries. Notice that Angular automatically places `ng-scope` class on elements where scopes are attached. The `<style>` definition in this example highlights in red the new scope locations. The -child scopes are necessary because the repeater evaluates `{{employee.name}}` expression, but +child scopes are necessary because the repeater evaluates `{{name}}` expression, but depending on which scope the expression is evaluated it produces different result. Similarly the evaluation of `{{department}}` prototypically inherits from root scope, as it is the only place where the `department` property is defined. |
