小编And*_*der的帖子

Angular2设置默认路由

我在模块中设置我的路由,我想设置默认路由,但它失败了

这是路由模块

const appRoutes: Routes = [
 { path: 'login', component: LoginComponent, useAsDefault:true }, //returns an error
 {
  path: 'dash',
  redirectTo:"dashboard"
},

{ path: 'reset-password', component: ResetPasswordComponent },
{ path: '',    redirectTo: '/dashboard', pathMatch: 'full'  },
{ path: '**', component: PageNotFoundComponent }
];
Run Code Online (Sandbox Code Playgroud)

以上返回错误

LoginComponent; useAsD...' is not assignable to type 'Route[]'
Run Code Online (Sandbox Code Playgroud)

可能有什么不对

typescript angular

6
推荐指数
1
解决办法
2万
查看次数

标签 统计

angular ×1

typescript ×1