@@ -119,38 +119,39 @@ ngRouteModule.directive('ngView', ngViewFillContentFactory);
119
119
</file>
120
120
121
121
<file name="script.js">
122
- angular.module('ngViewExample', ['ngRoute', 'ngAnimate'],
123
- function($routeProvider, $locationProvider) {
124
- $routeProvider.when('/Book/:bookId', {
125
- templateUrl: 'book.html',
126
- controller: BookCtrl,
127
- controllerAs: 'book'
128
- });
129
- $routeProvider.when('/Book/:bookId/ch/:chapterId', {
130
- templateUrl: 'chapter.html',
131
- controller: ChapterCtrl,
132
- controllerAs: 'chapter'
133
- });
122
+ angular.module('ngViewExample', ['ngRoute', 'ngAnimate'])
123
+ .config(['$routeProvider', '$locationProvider',
124
+ function($routeProvider, $locationProvider) {
125
+ $routeProvider
126
+ .when('/Book/:bookId', {
127
+ templateUrl: 'book.html',
128
+ controller: 'BookCtrl',
129
+ controllerAs: 'book'
130
+ })
131
+ .when('/Book/:bookId/ch/:chapterId', {
132
+ templateUrl: 'chapter.html',
133
+ controller: 'ChapterCtrl',
134
+ controllerAs: 'chapter'
135
+ });
136
+
137
+ // configure html5 to get links working on jsfiddle
138
+ $locationProvider.html5Mode(true);
139
+ }])
140
+ .controller('MainCtrl', ['$route', '$routeParams', '$location',
141
+ function($route, $routeParams, $location) {
142
+ this.$route = $route;
143
+ this.$location = $location;
144
+ this.$routeParams = $routeParams;
145
+ }])
146
+ .controller('BookCtrl', ['$routeParams', function($routeParams) {
147
+ this.name = "BookCtrl";
148
+ this.params = $routeParams;
149
+ }])
150
+ .controller('ChapterCtrl', ['$routeParams', function($routeParams) {
151
+ this.name = "ChapterCtrl";
152
+ this.params = $routeParams;
153
+ }]);
134
154
135
- // configure html5 to get links working on jsfiddle
136
- $locationProvider.html5Mode(true);
137
- });
138
-
139
- function MainCtrl($route, $routeParams, $location) {
140
- this.$route = $route;
141
- this.$location = $location;
142
- this.$routeParams = $routeParams;
143
- }
144
-
145
- function BookCtrl($routeParams) {
146
- this.name = "BookCtrl";
147
- this.params = $routeParams;
148
- }
149
-
150
- function ChapterCtrl($routeParams) {
151
- this.name = "ChapterCtrl";
152
- this.params = $routeParams;
153
- }
154
155
</file>
155
156
156
157
<file name="protractor.js" type="protractor">
0 commit comments