2016-10-04 7 views
0

RC5からルータ3.0.0.rc-3を使用してアプリケーションを角度2のRC7にアップグレードしようとしています。 しかし、私は子供のルートファイルで次のエラーを受け取ります。ルート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()'、routes、... –

+0

** Angular 2 Final **はほぼ一ヶ月前にリリースされました。アップグレードを強くお勧めします。 ルーターガイド:https://angular.io/docs/ts/latest/guide/router.html –

答えて

2

terminalプロパティはサポートされなくなりました新しいルータではd。それを取り出して、すべてが構築されるはずです。

0

ターミナルプロパティを削除し、ここで示されているものを実装しようと、

children: [ 
    { 
    path: '', 
    redirectTo: 'home', 
    pathMatch: 'full' 
    }, 
    ... 
] 
関連する問題