Angular New Router не загружает шаблон при обновлении страницы, контроллер работает

У меня есть следующее:

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 не загружается.

Контроллер загружается, он входит в консоль. Другие ошибки не генерируются.

0 ответов

Другие вопросы по тегам