错误:没有为TermsConditions找到组件工厂

Ash*_*ngh 2 angular2-router3 angular

我收到此错误:

使用angular2-rc6时,没有为TermsConditions找到组件工厂.

我的路线图是这样的:

{
    path: '',
    component: TermsConditions
}
Run Code Online (Sandbox Code Playgroud)

Ash*_*ngh 6

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

没有为TermsConditions找到组件工厂.

  @NgModule({ 
          declarations : [ TermsConditionsComponent ]
        }) 
        export default class TermsConditions {}
Run Code Online (Sandbox Code Playgroud)
  1. 将此模块导入您的根模块.

       @NgModule({ 
          declarations : [ AppComponent ],
          imports: [ BrowserModule, TermsConditions ],
          bootstrap: [ AppComponent ]
        }) 
        export default class AppModule {}
    
    Run Code Online (Sandbox Code Playgroud)
  2. 在路由中使用组件.

    { 
      path : 'terms',
      component : TermsConditionsComponent
    }
    `
    
    Run Code Online (Sandbox Code Playgroud)

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