Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Rename controller suffix in ngView example: Cntl -> Ctrl #5817

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions src/ngRoute/directive/ngView.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ ngRouteModule.directive('ngView', ngViewFillContentFactory);
* @example
<example module="ngViewExample" deps="angular-route.js" animations="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> |
Expand Down Expand Up @@ -121,32 +121,32 @@ 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'
});

// configure html5 to get links working on jsfiddle
$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>
Expand All @@ -155,13 +155,13 @@ ngRouteModule.directive('ngView', ngViewFillContentFactory);
it('should load and compile correct template', function() {
element('a:contains("Moby: Ch1")').click();
var content = element('.doc-example-live [ng-view]').text();
expect(content).toMatch(/controller\: ChapterCntl/);
expect(content).toMatch(/controller\: ChapterCtrl/);
expect(content).toMatch(/Book Id\: Moby/);
expect(content).toMatch(/Chapter Id\: 1/);

element('a:contains("Scarlet")').click();
content = element('.doc-example-live [ng-view]').text();
expect(content).toMatch(/controller\: BookCntl/);
expect(content).toMatch(/controller\: BookCtrl/);
expect(content).toMatch(/Book Id\: Scarlet/);
});
</file>
Expand Down