如何从当前组件导航到另一个组件?我试过这样:
帐户组件:
vm.$onInit = function () {
var jwt = accountService.getJWT();
if (!jwt || jwtHelper.isTokenExpired(jwt)) {
this.$router.navigate(['registration']);
}
};
这对我不起作用:(
Component "Root" has no route config.
我已经设置了 $routerRootComponent
.value('$routerRootComponent', 'app')
.component('app', {
template: '<ng-outlet></ng-outlet>',
$routeConfig: [
{path: '/registration', component: 'registration', useAsDefault: true},
{path: '/registration/:referrer', component: 'registration'},
{path: '/account', component: 'account'}
]
})