2
AM设置模块在我的路由,我想设置默认路由,但它不能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 }
];
以上返回
错误LoginComponent; useAsD...' is not assignable to type 'Route[]'
什么可能是错的
请看看http://stackoverflow.com/questions/37605119/angular2-router-angular-router-how-to-set-default-route –
有什么不对?你有错误的清晰的反应;)因为路由器没有'useAsDefault'属性,检查它:https://angular.io/docs/ts/latest/api/router/index/Route-interface.html – Daredzik