升级到角度2 RC7问题与路线
问题描述:
我想升级我们的应用程序角2 RC7与RC5路由器3.0.0.rc-3。 但我在子路径文件中得到以下错误。升级到角度2 RC7问题与路线
ERROR in [default] C:/src/app/routes/childroute1/child-routes-one.routes.ts:31:8
Type '{ path: string; component: typeof childRouteOne; data: { displayName: string; }; childre...' is not assignable to type 'Route[]'.
Type '{ path: string; component: typeof childRouteOne; data: { displayName: string; }; childre...' is not assignable to type 'Route'.
Types of property 'children' are incompatible.
Type '({ path: string; redirectTo: string; terminal: boolean; } | { path: string; component: typeof fea...' is not assignable to type 'Route[]'.
Type '{ path: string; redirectTo: string; terminal: boolean; } | { path: string; component: typeof feas...' is not assignable to type 'Route'.
Type '{ path: string; redirectTo: string; terminal: boolean; }' is not assignable to type 'Route'.
Object literal may only specify known properties, and 'terminal' does not exist in type 'Route'.
是否必须更改(添加或删除)子路径中的任何内容?或者是任何依赖关系的问题?
当我尝试@angular/router : 3.0.0.rc-2
和rxjs: 5.0.0-beta.6
,我没有得到一个错误。
儿童路线,one.routes.ts
import {Routes, ActivatedRoute} from '@angular/router';
export const settingsRoute: Routes = [
{
path: 'ev/route-one/:Id/:usrId',
component: childRouteOne,
data: { displayName: 'Settings' },
children: [
{
path: '',
redirectTo: 'home',
terminal: true
},
{ path: 'home', component: feature-home, data: { displayName: 'Home' } },
{ path: 'notes/notes-settings/:Id', component: notesSettings, data: { displayName: 'Notifications' } }
]
}
];
@NgModule进口:
imports: [ BrowserModule, RouterModule, CommonModule, FormsModule, ReactiveFormsModule, HttpModule, routing, RouterModule.forChild(settingsRoute) ],
答
terminal
财产不再支持d在较新的路由器中。拿出来,一切都应该建立。
答
删除终端性能,并尝试实现的东西在这里显示,
children: [
{
path: '',
redirectTo: 'home',
pathMatch: 'full'
},
...
]
显示路由代码。 – micronyks
请发表更多代码。 '@NgModule()',路线,... –
** Angular 2 Final **于近一个月前发布。我强烈建议升级。 路由器指南:https://angular.io/docs/ts/latest/guide/router.html –