2016-10-04 68 views
0

我想升級我們的應用程序角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-2rxjs: 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) ], 
+0

顯示路由代碼。 – micronyks

+0

請發表更多代碼。 '@NgModule()',路線,... –

+0

** Angular 2 Final **於近一個月前發佈。我強烈建議升級。 路由器指南:https://angular.io/docs/ts/latest/guide/router.html –

回答

2

terminal財產不再支持d在較新的路由器中。拿出來,一切都應該建立。

0

刪除終端性能,並嘗試實現的東西在這裏顯示,

children: [ 
    { 
    path: '', 
    redirectTo: 'home', 
    pathMatch: 'full' 
    }, 
    ... 
]