2016-08-15 2 views
0

내 앱을 RC5로 업그레이드하는 중 일부 문제가 있습니다. 내 app.routing.ts에서각도 2 RC5 어떤 경로와도 일치 할 수 없습니다 : 'documents'

, 내가 가진 : food.routing.ts에서

getLoggedInMenu() { 
    return [ 
    { 
     label: 'Home', 
     routerLink: [''] 
    }, { 
     label: 'Documents', 
     routerLink: ['/documents'] 
    }, { 
     label: 'Tools', 
     Items: [ 
     { 
     label: 'Food', 
     routerLink: ['/food'] 
     }, { 
     label: 'Themes', 
     routerLink: ['/themes'] 
     } ] 
    }, 
    { 
    label: 'About', 
    routerLink: ['/about'] 
    }]; 
} 

:

import { RouterModule } from '@angular/router'; 
import {FoodComponent} from './food.component'; 

export const routing = RouterModule.forChild([ 
    { path: 'food', component: FoodComponent}]); 

여기에

import { Routes, RouterModule } from '@angular/router'; 

export const appRoutes: Routes = [ 
{ path: '', redirectTo: '/home', pathMatch: 'full' }, 
{ path: 'home', loadChildren: './app/home/home.module#HomeModule' }, 
{ path: 'documents', loadChildren: './app/documents/documents.module#DocumentsModule' }, 
{ path: 'food', loadChildren: './app/food/food.module#FoodModule' }, 
{ path: 'themes', loadChildren: './app/themes/themes.module#ThemesModule' }, 
{ path: 'about', loadChildren: './app/about/about.module#AboutModule' }]; 

export const appRoutingProviders: any[] = []; 

export const routing = RouterModule.forRoot(appRoutes); 

는 라우터 링크입니다 주제 .routing.ts :

import { RouterModule } from '@angular/router'; 
import {ThemesComponent} from './themes.component'; 

export const routing = RouterModule.forChild([ 
{ path: 'themes', component: ThemesComponent}]); 

이 두 경로는 정상적으로 작동합니다. 그러나이 두 노선들은 그렇지 않은 :

document.routing.ts에서 :

import { RouterModule } from '@angular/router'; 
import {DocumentsComponent} from './documents.component'; 

export const routing = RouterModule.forChild([ 
{ path: 'documents', component: DocumentsComponent}]); 

오류 : 예외 : 오류 : 오류 : (약속을) catch되지 않은 어떤 경로를 일치 할 수 없습니다 : '문서'

about.routing.ts에서

:

import { RouterModule } from '@angular/router'; 
import {AboutComponent} from './about.component'; 

export const routing = RouterModule.forChild([ 
    { path: 'about', component: AboutComponent}]); 

오류 : 예외 : 오류 : catch되지 않은은 (약속) : 오류 : 어떤 경로를 일치 할 수 없습니다

01 '에 대해'

각 앱 디렉토리는 동일합니다. 각각 포함

name.component.ts
name.component.css
name.component.html
name.module.ts
name.routing.ts

각각의 내용 이름을 제외하면 동일합니다.

아무 것도 볼 수 없습니까?

답변

0

많은 양의 매스컴 작업 후에 app.module.ts에 작업 모듈 라우팅을위한 가져 오기가 있고 실패한 항목이 없었던 것으로 나타났습니다. 이를 가져 와서 app.module imports 섹션에 추가하면 문제가 해결되고 모든 경로가 작동합니다.

+1

나는 이것을 시도했다. 하지만 이렇게하면 응용 프로그램이 시작될 때 가져온 모듈이로드됩니다. 이로 인해 응용 프로그램은 작동하지만 구성 요소의 동적로드 목표는 무시됩니다. 그렇지 않니? 이걸 가져 왔니? 당신의 경험을 공유 할 수 있습니까? – Patrice

관련 문제