错误:找不到用于TermsConditions的组件工厂 [英] Error: No component factory found for TermsConditions

查看:74
本文介绍了错误:找不到用于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.

    这篇关于错误:找不到用于TermsConditions的组件工厂的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆