我有以下内容:
function AppController ($router, authService) {
$router.config ([
{ path: '/', redirectTo: '/home' },
{ path: '/home', components: {'main' : 'home' }},
{ path: '/account', components: {'main' : 'account' }},
{ path: '/campaigns', components: {'main' : 'campaigns' }},
{ path: '/login', components: {'main' : 'login' }}
]);
}
angular.module('app.account', ['security'])
.controller('AccountController', ['authService', AccountController]);
function AccountController (authService) {
console.log ('this is account controller');
doCommonController.call(this, authService);
}
//before switching
AccountController.prototype.canActivate = function() {
return this.authService.isAuthenticated();
}
//before navigation finishes, useful to load required data
AccountController.prototype.activate = function() {
// return this.testme = true;
//return this.bigFiles = this.$http.downloadBigFiles();
}
如果我点击菜单中的链接,一切正常。如果我刷新页面,则不会加载account.html的模板。
控制器加载,它在控制台内登录。没有产生其他错误。