Using ngRoute with 'controller as' syntax in angularJS
问题 I have the following config and controllers .config(function($routeProvider){ $routeProvider .when('/', { templateUrl: 'page-home.html', controller: 'homeController', controllerAs: 'hctrl' }) .when('/about', { templateUrl: 'page-about.html', controller: 'aboutController', controllerAs: 'actrl' }) .when('/contact', { templateUrl: 'page-contact.html', controller: 'contactController', controllerAs: 'cctrl' }); }) .controller('homeController', function(){ this.pageClass = 'page-home' })