Error: No component factory found for TermsConditions

走远了吗. 提交于 2020-01-04 09:04:10

问题


I am getting this Error:

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

My route map is like this:

{
    path: '',
    component: TermsConditions
}

回答1:


Thanks for your help. I got to know how to fix this issue.

No component factory found for TermsConditions.

  @NgModule({ 
          declarations : [ TermsConditionsComponent ]
        }) 
        export default class TermsConditions {}
  1. Import this module to your root module.

       @NgModule({ 
          declarations : [ AppComponent ],
          imports: [ BrowserModule, TermsConditions ],
          bootstrap: [ AppComponent ]
        }) 
        export default class AppModule {}
    
  2. use component in routing like.

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

It means your module is not available in application scope that is why your component is not being bind to router.




回答2:


You need to list the TermsConditions in both the declarations and entryComponents section.

https://stackoverflow.com/a/39376857



来源:https://stackoverflow.com/questions/39415903/error-no-component-factory-found-for-termsconditions

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!