2016-10-04 2 views
0

Я пытаюсь обновить наше приложение до углового 2 RC7 с маршрутизатором 3.0.0.rc-3 от RC5. Но я получаю следующие ошибки в файлах дочерних маршрутов.Обновление до углового 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) ], 
+0

показать код маршрутизации. – micronyks

+0

Пожалуйста, напишите больше кода. '@NgModule()', маршруты, ... –

+0

** Угловой 2 Final ** был выпущен почти месяц назад. Я настоятельно рекомендую обновить. Руководство по маршрутизатору: https://angular.io/docs/ts/latest/guide/router.html –

ответ

2

Недвижимость terminal больше не поддерживается d в новых маршрутизаторах. Возьмите это, и все должно строиться.

0

Снимите терминал свойство и попытаться осуществить то, что показано здесь,

children: [ 
    { 
    path: '', 
    redirectTo: 'home', 
    pathMatch: 'full' 
    }, 
    ... 
] 
Смежные вопросы