我使用ng serve
,並有這樣的路由配置角4不能
export const appRoutes: Routes = [
{
path: '',
children: [
{
path: '',
component: AuthComponent,
children: [
{
path: 'login',
component: LoginComponent
},
{
path: 'registration',
component: RegistrationComponent
}
]
},
{
path: 'restore',
component: RestoreComponent
},
{
path: 'newpass',
component: NewPassComponent
}
]
}
];
和auth.component.html兩粒扣
<nav>
<ul>
<li><a routerLink="/login" routerLinkActive="active-link">Login</a></li>
<li><a routerLink="/registration" routerLinkActive="active-link">Sign up</a></li>
</ul>
</nav>
當我點擊登錄鏈接,瀏覽角度我匹配任何路線登錄頁面沒有錯誤,但當我重新加載localhost:4200/login頁面,我得到這個錯誤
但頁面加載成功,組件將工作。
那麼,我該如何解決它,爲什麼角度使第二個NavigationStart /登錄/(登錄)?
,你可以嘗試使用'HashLocationStrategy' –
@ n00dl3但是當我刷新/重新加載頁面,角度沒有給出錯誤 – Ruslan