diff options
| author | unicodesnowman | 2014-03-08 13:04:06 -0500 | 
|---|---|---|
| committer | Brian Ford | 2014-03-17 14:55:00 -0700 | 
| commit | 68e84acec9ebd29daafb35ae7e9435e2ba285530 (patch) | |
| tree | d5788ae757b3537dadc860d1b10da84cbec89720 /src/ngRoute/directive | |
| parent | e118a8be341a1e7d354ac36ddc04842f11a63e00 (diff) | |
| download | angular.js-68e84acec9ebd29daafb35ae7e9435e2ba285530.tar.bz2 | |
docs(ngView): remove global controller definitions
instead use angular modules
also fix formatting
Diffstat (limited to 'src/ngRoute/directive')
| -rw-r--r-- | src/ngRoute/directive/ngView.js | 63 | 
1 files changed, 32 insertions, 31 deletions
| diff --git a/src/ngRoute/directive/ngView.js b/src/ngRoute/directive/ngView.js index a25563ae..85049d4a 100644 --- a/src/ngRoute/directive/ngView.js +++ b/src/ngRoute/directive/ngView.js @@ -119,38 +119,39 @@ ngRouteModule.directive('ngView', ngViewFillContentFactory);        </file>        <file name="script.js"> -        angular.module('ngViewExample', ['ngRoute', 'ngAnimate'], -          function($routeProvider, $locationProvider) { -            $routeProvider.when('/Book/:bookId', { -              templateUrl: 'book.html', -              controller: BookCtrl, -              controllerAs: 'book' -            }); -            $routeProvider.when('/Book/:bookId/ch/:chapterId', { -              templateUrl: 'chapter.html', -              controller: ChapterCtrl, -              controllerAs: 'chapter' -            }); +        angular.module('ngViewExample', ['ngRoute', 'ngAnimate']) +          .config(['$routeProvider', '$locationProvider', +            function($routeProvider, $locationProvider) { +              $routeProvider +                .when('/Book/:bookId', { +                  templateUrl: 'book.html', +                  controller: 'BookCtrl', +                  controllerAs: 'book' +                }) +                .when('/Book/:bookId/ch/:chapterId', { +                  templateUrl: 'chapter.html', +                  controller: 'ChapterCtrl', +                  controllerAs: 'chapter' +                }); + +              // configure html5 to get links working on jsfiddle +              $locationProvider.html5Mode(true); +          }]) +          .controller('MainCtrl', ['$route', '$routeParams', '$location', +            function($route, $routeParams, $location) { +              this.$route = $route; +              this.$location = $location; +              this.$routeParams = $routeParams; +          }]) +          .controller('BookCtrl', ['$routeParams', function($routeParams) { +            this.name = "BookCtrl"; +            this.params = $routeParams; +          }]) +          .controller('ChapterCtrl', ['$routeParams', function($routeParams) { +            this.name = "ChapterCtrl"; +            this.params = $routeParams; +          }]); -            // configure html5 to get links working on jsfiddle -            $locationProvider.html5Mode(true); -        }); - -        function MainCtrl($route, $routeParams, $location) { -          this.$route = $route; -          this.$location = $location; -          this.$routeParams = $routeParams; -        } - -        function BookCtrl($routeParams) { -          this.name = "BookCtrl"; -          this.params = $routeParams; -        } - -        function ChapterCtrl($routeParams) { -          this.name = "ChapterCtrl"; -          this.params = $routeParams; -        }        </file>        <file name="protractor.js" type="protractor"> | 
