@@ -271,7 +271,7 @@ function $RouteProvider(){
271
271
* <example name="$route-service" module="ngRouteExample"
272
272
* deps="angular-route.js" fixBase="true">
273
273
* <file name="index.html">
274
- * <div ng-controller="MainCntl ">
274
+ * <div ng-controller="MainController ">
275
275
* Choose:
276
276
* <a href="Book/Moby">Moby</a> |
277
277
* <a href="Book/Moby/ch/1">Moby: Ch1</a> |
@@ -280,6 +280,7 @@ function $RouteProvider(){
280
280
* <a href="Book/Scarlet">Scarlet Letter</a><br/>
281
281
*
282
282
* <div ng-view></div>
283
+ *
283
284
* <hr />
284
285
*
285
286
* <pre>$location.path() = {{$location.path()}}</pre>
@@ -304,10 +305,27 @@ function $RouteProvider(){
304
305
* <file name="script.js">
305
306
* angular.module('ngRouteExample', ['ngRoute'])
306
307
*
308
+ * .controller('MainController', function($scope, $route, $routeParams, $location) {
309
+ * $scope.$route = $route;
310
+ * $scope.$location = $location;
311
+ * $scope.$routeParams = $routeParams;
312
+ * })
313
+ *
314
+ * .controller('BookController', function($scope, $routeParams) {
315
+ * $scope.name = "BookController";
316
+ * $scope.params = $routeParams;
317
+ * })
318
+ *
319
+ * .controller('ChapterController', function($scope, $routeParams) {
320
+ * $scope.name = "ChapterController";
321
+ * $scope.params = $routeParams;
322
+ * })
323
+ *
307
324
* .config(function($routeProvider, $locationProvider) {
308
- * $routeProvider.when('/Book/:bookId', {
325
+ * $routeProvider
326
+ * .when('/Book/:bookId', {
309
327
* templateUrl: 'book.html',
310
- * controller: BookCntl ,
328
+ * controller: 'BookController' ,
311
329
* resolve: {
312
330
* // I will cause a 1 second delay
313
331
* delay: function($q, $timeout) {
@@ -316,45 +334,30 @@ function $RouteProvider(){
316
334
* return delay.promise;
317
335
* }
318
336
* }
319
- * });
320
- * $routeProvider .when('/Book/:bookId/ch/:chapterId', {
337
+ * })
338
+ * .when('/Book/:bookId/ch/:chapterId', {
321
339
* templateUrl: 'chapter.html',
322
- * controller: ChapterCntl
340
+ * controller: 'ChapterController'
323
341
* });
324
342
*
325
343
* // configure html5 to get links working on jsfiddle
326
344
* $locationProvider.html5Mode(true);
327
345
* });
328
346
*
329
- * function MainCntl($scope, $route, $routeParams, $location) {
330
- * $scope.$route = $route;
331
- * $scope.$location = $location;
332
- * $scope.$routeParams = $routeParams;
333
- * }
334
- *
335
- * function BookCntl($scope, $routeParams) {
336
- * $scope.name = "BookCntl";
337
- * $scope.params = $routeParams;
338
- * }
339
- *
340
- * function ChapterCntl($scope, $routeParams) {
341
- * $scope.name = "ChapterCntl";
342
- * $scope.params = $routeParams;
343
- * }
344
347
* </file>
345
348
*
346
349
* <file name="protractor.js" type="protractor">
347
350
* it('should load and compile correct template', function() {
348
351
* element(by.linkText('Moby: Ch1')).click();
349
352
* var content = element(by.css('[ng-view]')).getText();
350
- * expect(content).toMatch(/controller\: ChapterCntl /);
353
+ * expect(content).toMatch(/controller\: ChapterController /);
351
354
* expect(content).toMatch(/Book Id\: Moby/);
352
355
* expect(content).toMatch(/Chapter Id\: 1/);
353
356
*
354
357
* element(by.partialLinkText('Scarlet')).click();
355
358
*
356
359
* content = element(by.css('[ng-view]')).getText();
357
- * expect(content).toMatch(/controller\: BookCntl /);
360
+ * expect(content).toMatch(/controller\: BookController /);
358
361
* expect(content).toMatch(/Book Id\: Scarlet/);
359
362
* });
360
363
* </file>
0 commit comments