diff options
| author | Andrew Stuart | 2013-10-24 11:19:28 -0700 | 
|---|---|---|
| committer | Pete Bacon Darwin | 2013-10-26 19:36:53 +0100 | 
| commit | 3cfe9575e94b73165272a7c5a8f351419f625170 (patch) | |
| tree | 040fd0504528895a48955f71908042112819a53c /docs | |
| parent | 05bc53d34d8843f97dc9f561ce23829989299554 (diff) | |
| download | angular.js-3cfe9575e94b73165272a7c5a8f351419f625170.tar.bz2 | |
docs(guide/understanding_controller): apply a more intuitive metaphor
The BabyCtrl was a bit confusing and GrandChildCtrl seems to make more sense
with the whole "scope inheritance" concept.
Closes #4634
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/content/guide/dev_guide.mvc.understanding_controller.ngdoc | 16 | 
1 files changed, 8 insertions, 8 deletions
diff --git a/docs/content/guide/dev_guide.mvc.understanding_controller.ngdoc b/docs/content/guide/dev_guide.mvc.understanding_controller.ngdoc index 5b0510c0..dd339b58 100644 --- a/docs/content/guide/dev_guide.mvc.understanding_controller.ngdoc +++ b/docs/content/guide/dev_guide.mvc.understanding_controller.ngdoc @@ -221,7 +221,7 @@ more information about scope inheritance.          <div ng-controller="ChildCtrl">            <p>Good {{timeOfDay}}, {{name}}!</p> -          <div ng-controller="BabyCtrl"> +          <div ng-controller="GrandChildCtrl">              <p>Good {{timeOfDay}}, {{name}}!</p>            </div>          </div> @@ -242,7 +242,7 @@ more information about scope inheritance.        myApp.controller('ChildCtrl', ['$scope', function($scope){          $scope.name = 'Mattie';        }]); -      myApp.controller('BabyCtrl', ['$scope', function($scope){ +      myApp.controller('GrandChildCtrl', ['$scope', function($scope){          $scope.timeOfDay = 'evening';          $scope.name = 'Gingerbreak Baby';        }]); @@ -257,7 +257,7 @@ scopes being created for our view:  - The `MainCtrl` scope, which contains `timeOfDay` and `name` properties  - The `ChildCtrl` scope, which inherits the `timeOfDay` property but overrides (hides) the `name`  property from the previous -- The `BabyCtrl` scope, which overrides (hides) both the `timeOfDay` property defined in `MainCtrl` +- The `GrandChildCtrl` scope, which overrides (hides) both the `timeOfDay` property defined in `MainCtrl`  and the `name` property defined in `ChildCtrl`  Inheritance works with methods in the same way as it does with properties. So in our previous @@ -312,7 +312,7 @@ in your test that exists in the DOM:  <pre>  describe('state', function() { -    var mainScope, childScope, babyScope; +    var mainScope, childScope, grandChildScope;      beforeEach(module('myApp')); @@ -321,8 +321,8 @@ describe('state', function() {          $controller('MainCtrl', {$scope: mainScope});          childScope = mainScope.$new();          $controller('ChildCtrl', {$scope: childScope}); -        babyScope = childScope.$new(); -        $controller('BabyCtrl', {$scope: babyScope}); +        grandChildScope = childScope.$new(); +        $controller('GrandChildCtrl', {$scope: grandChildScope});      }));      it('should have over and selected', function() { @@ -330,8 +330,8 @@ describe('state', function() {          expect(mainScope.name).toBe('Nikki');          expect(childScope.timeOfDay).toBe('morning');          expect(childScope.name).toBe('Mattie'); -        expect(babyScope.timeOfDay).toBe('evening'); -        expect(babyScope.name).toBe('Gingerbreak Baby'); +        expect(grandChildScope.timeOfDay).toBe('evening'); +        expect(grandChildScope.name).toBe('Gingerbreak Baby');      });  });  </pre>  | 
