angular - 错误: No component factory found for TermsConditions

标签 angular angular2-router3

我收到此错误:

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

我的路线图是这样的:

{
    path: '',
    component: TermsConditions
}

最佳答案

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

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
    }
    `
    

这意味着您的模块在应用程序范围内不可用,这就是您的组件未绑定(bind)到路由器的原因。

关于angular - 错误: No component factory found for TermsConditions,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39415903/

相关文章:

Angular2 路由器 : Get Route for URL without navigating

angular - 如何在 Angular 库中包含图像?

http - 如何使用 observable .map 和 .subscribe 处理我的数据

regex - Validations.pattern 不适用于正则表达式

javascript - 如何在另一个模块中使用一个模块并在 Angular 8 中路由该模块?

html - 数据表寻呼机的下一个按钮和后退按钮不起作用

angular - 如何在我的页面加载/卸载时实现淡入/淡出效果?

angular - canDeactivate 中的返回 Observable 不起作用