4

我有以下内容:

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 的模板。

控制器加载,它在控制台内记录。没有产生其他错误。

4

0 回答 0