docs(ngView): rename controller suffix in ngView example

- According to
  https://github.com/angular/angular.js/blob/5bf81bc111a866ec65ef86c01336911e577df5df/docs/content/guide/controller.ngdoc#L166
  Ctrl should be the suffix for a controller

Closes #5817
This commit is contained in:
Gronblom Sam
2014-01-15 19:02:30 +09:00
committed by Pawel Kozlowski
parent 9bffccd935
commit d5f2084883
+10 -10
View File
@@ -40,7 +40,7 @@ ngRouteModule.directive('ngView', ngViewFillContentFactory);
deps="angular-route.js;angular-animate.js"
animations="true" fixBase="true">
<file name="index.html">
<div ng-controller="MainCntl as main">
<div ng-controller="MainCtrl as main">
Choose:
<a href="Book/Moby">Moby</a> |
<a href="Book/Moby/ch/1">Moby: Ch1</a> |
@@ -123,12 +123,12 @@ ngRouteModule.directive('ngView', ngViewFillContentFactory);
function($routeProvider, $locationProvider) {
$routeProvider.when('/Book/:bookId', {
templateUrl: 'book.html',
controller: BookCntl,
controller: BookCtrl,
controllerAs: 'book'
});
$routeProvider.when('/Book/:bookId/ch/:chapterId', {
templateUrl: 'chapter.html',
controller: ChapterCntl,
controller: ChapterCtrl,
controllerAs: 'chapter'
});
@@ -136,19 +136,19 @@ ngRouteModule.directive('ngView', ngViewFillContentFactory);
$locationProvider.html5Mode(true);
});
function MainCntl($route, $routeParams, $location) {
function MainCtrl($route, $routeParams, $location) {
this.$route = $route;
this.$location = $location;
this.$routeParams = $routeParams;
}
function BookCntl($routeParams) {
this.name = "BookCntl";
function BookCtrl($routeParams) {
this.name = "BookCtrl";
this.params = $routeParams;
}
function ChapterCntl($routeParams) {
this.name = "ChapterCntl";
function ChapterCtrl($routeParams) {
this.name = "ChapterCtrl";
this.params = $routeParams;
}
</file>
@@ -157,14 +157,14 @@ ngRouteModule.directive('ngView', ngViewFillContentFactory);
it('should load and compile correct template', function() {
element(by.linkText('Moby: Ch1')).click();
var content = element(by.css('[ng-view]')).getText();
expect(content).toMatch(/controller\: ChapterCntl/);
expect(content).toMatch(/controller\: ChapterCtrl/);
expect(content).toMatch(/Book Id\: Moby/);
expect(content).toMatch(/Chapter Id\: 1/);
element(by.partialLinkText('Scarlet')).click();
content = element(by.css('[ng-view]')).getText();
expect(content).toMatch(/controller\: BookCntl/);
expect(content).toMatch(/controller\: BookCtrl/);
expect(content).toMatch(/Book Id\: Scarlet/);
});
</file>