2016-09-07 2 views
1

각도 2 베타 14로 작성된 각도 2 앱이 있습니다.이를 rc5로 업그레이드 중입니다. 이제경로 설정시 각도 2의 이름 사용

{path:'/...',name:'LoggedIn',component:LoggedInComponent}, 
{path:'/auth', name:'Auth', component:AuthComponent} 

나는이

import { RouterModule , Routes } from '@angular/router'; 
import {AuthComponent} from "./auth/auth.component"; 
import {LoggedInComponent} from "./auth/logged-in.component"; 
import {LOGGED_IN_ROUTES} from "./auth/logged-in.routes"; 
const APP_ROUTES : Routes = [ 
    { path : '/...' , name :'LoggedIn' , component : LoggedInComponent , children : LOGGED_IN_ROUTES}, 
    { path : '' , component : AuthComponent}, 
    { path : 'auth' , component : AuthComponent}, 

]; 
export const routing = RouterModule.forRoot(APP_ROUTES); 

내가

같은 오류를 얻고있다처럼 일을 오전 : 나는 최신 라우터를 사용하고, 내 패키지 JSON은 "@angular/router": "3.0.0-rc.1"

이전

루트 같이 구성된 포함

Type '({ path: string; name: string; component: typeof LoggedInComponent; children: Route[]; } | { path...' is not assignable to type 'Route[]'. 
    Type '{ path: string; name: string; component: typeof LoggedInComponent; children: Route[]; } | { path:...' is not assignable to type 'Route'. 
    Type '{ path: string; name: string; component: typeof LoggedInComponent; children: Route[]; }' is not assignable to type 'Route'. 
     Object literal may only specify known properties, and 'name' does not exist in type 'Route'. 
+0

경로 설정에서'name'을 제거하십시오 ... –

답변

1

name은 현재 사용 중지되었으며 API는 업그레이드되었습니다. nce 베타에 대한 자세한 내용은 here을 참조하십시오.

배열이 도움이 this

희망을 볼 노선과 경로의 스키마를 구성하는 방법을 확인하려면!