错误:找不到用于TermsConditions的组件工厂

问题描述:

我遇到此错误:

在使用angular2-rc6时,未找到TermsConditions的组件工厂.

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

我的路线图是这样的:

{
    path: '',
    component: TermsConditions
}

感谢您的帮助.我知道如何解决这个问题.

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. 将此模块导入您的根模块.

  1. Import this module to your root module.

   @NgModule({ 
      declarations : [ AppComponent ],
      imports: [ BrowserModule, TermsConditions ],
      bootstrap: [ AppComponent ]
    }) 
    export default class AppModule {}

  • 在路由选择中使用组件.

  • 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.