2016-05-24 90 views
1

我使用的RC路由器的RC1和我定义了两个路线如下方案路线导航:问题用角2 RC路由器

@Routes([ 
    {path: '/', component: HomeComponent}, 
    {path: '/signin', component: SigninComponent}, 
    {path: '/dashboard', component: DashboardComponent} 
]) 

,我试图在注册时浏览到'/signin'出来的如下:

import {Router} from "@angular/router"; 

@Component({ 
    selector: '[signout]', 
    templateUrl: 'app/session/session.signout.component.html', 
    directives: [CORE_DIRECTIVES], 
    pipes: [TranslatePipe] 
}) 
export class SignoutComponent { 

    constructor(private router:Router, 
       private sessionService:SessionService) { 
    } 

    signout() { 
     this.sessionService.signout(); 
     //FIXME: does not navigate to '/signin' 
     this.router.navigate(['/signin']); 
    } 

} 

然而,当我登出,在浏览器中显示的路径/ URL是根URL(/),而不是登入网址...

我错了什么?

回答

0

变化

@Routes([ 
    {path: '/', component: HomeComponent}, 
    {path: '/signin', component: SigninComponent}, 
    {path: '/dashboard', component: DashboardComponent} 
]) 

@Routes([ 
    {path: '/signin', component: SigninComponent}, 
    {path: '/dashboard', component: DashboardComponent} 
    {path: '/', component: HomeComponent}, 
]) 

这是一个已知问题,应固定下一个版本之一。

+0

没有运气提供的解决方案。你能指点我在github中的相关问题吗? – balteo

+1

这是在几个地方提到的。一个是https://github.com/angular/angular/issues/8420 –

+0

谢谢。我在控制台中没有任何异常。这可能是一个不同的错误。我会等到新的RC出来看看。 – balteo