2016-09-09 3 views
1

에 대한 찾을 수 없습니다 부품 공장 :오류 :이 오류를 얻고있다 TermsConditions

No component factory found for TermsConditions while using angular2-rc6.

내 노선도는 다음과 같이이다 : 당신의 도움에 대한

{ 
    path: '', 
    component: TermsConditions 
} 
+0

'TermsConditions' 구성 요소를 내 보냅니 까? –

+0

@MadhuRanjan : 왜 이것이 필요한지 조금 더 설명해 주시겠습니까? @NgModule ({ 수입 [RouterModule] 선언 [ TermsConditionsComponent ] }) 수출 기본 클래스 TermsConditions {} –

+0

는'declarations' 모듈 내에서 구성 요소를 사용하기위한, 그리고 'exports' 사용위한 그것 외부. 모듈 [here] (https://angular.io/docs/ts/latest/guide/ngmodule.html) 및 [FAQ here] (https://angular.io/docs/ts/latest/)에 대한 자세한 내용을 볼 수 있습니다. cookbook/ngmodule-faq.html)에서이 개념을 깊이있게 설명합니다. –

답변

5

감사합니다. 이 문제를 해결하는 방법을 알아야합니다.

No component factory found for TermsConditions.

@NgModule({ 
      declarations : [ TermsConditionsComponent ] 
     }) 
     export default class TermsConditions {} 
  1. 가져 오기 루트 모듈이 모듈.

    @NgModule({ 
         declarations : [ AppComponent ], 
         imports: [ BrowserModule, TermsConditions ], 
         bootstrap: [ AppComponent ] 
        }) 
        export default class AppModule {} 
    
  2. 같은 라우팅 구성 요소를 사용하십시오.

    { 
        path : 'terms', 
        component : TermsConditionsComponent 
    } 
    ` 
    

그것은 당신의 모듈이 구성 요소가 라우터에 결합되지 않는 이유는 해당 응용 프로그램의 범위에서 사용할 수 없습니다 의미합니다.

2

declarationsentryComponents 섹션에 TermsConditions를 나열해야합니다.

https://stackoverflow.com/a/39376857

+0

entryComponents는 하위 수준 앱이 아닌 루트 수준 앱에 사용됩니다. –

+0

하지만이 방법으로 작업하면 – Yougesh

+0

entryComponents는 모든 구성 요소 트리의 템플릿에 참조가없는 구성 요소를 나열하는 데 사용됩니다. –

관련 문제