Ts
const appRoutes: Routes = [
{
path: '',
redirectTo: 'login',
pathMatch: 'full'
},
{
path: 'login',
component: LoginComponent
},
{
path: 'dashboard',
canActivate: [AuthguardGuard],
component: MyNavComponent
},
{
path: '**',
redirectTo: 'login',
pathMatch: 'full'
}
];
当我进入仪表板路径并重新加载时,我得到一个空页面,如何解决此问题,请帮帮我吗?
答案 0 :(得分:0)
在AppModule路由器配置中启用初始导航。下面的示例:
@NgModule({
imports: [/*your imports */,
RouterModule.forRoot([/*your routes here*/], { initialNavigation: 'enabled' })],
exports: []
})
export class AppModule {}