2016-05-24 126 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