我使用的是带有webpack的Angular 4模板
当我尝试使用一个组件(ConfirmComponent)时,我有这个错误:
没有为ConfirmComponent找到组件工厂。你加进去了吗
@NgModule.entryComponents吗?
该组件在app.module.server.ts中声明
@NgModule({
bootstrap: [ AppComponent ],
imports: [
// ...
],
entryComponents: [
ConfirmComponent,
],
})
export class AppModule { }
还有app。module。browser。ts和app。module。shared。ts
我该怎么解决呢?
我在使用动态组件的ag网格中遇到了同样的问题。我发现你需要在ag-grid模块中添加动态组件。withcomponents []
进口:[
StratoMaterialModule,
BrowserModule,
AppRoutingModule,
HttpClientModule,
BrowserAnimationsModule,
NgbModule.forRoot (),
FormsModule,
ReactiveFormsModule,
AppRoutingModule,
AgGridModule.withComponents (ProjectUpdateButtonComponent)
],
我在使用动态组件的ag网格中遇到了同样的问题。我发现你需要在ag-grid模块中添加动态组件。withcomponents []
进口:[
StratoMaterialModule,
BrowserModule,
AppRoutingModule,
HttpClientModule,
BrowserAnimationsModule,
NgbModule.forRoot (),
FormsModule,
ReactiveFormsModule,
AppRoutingModule,
AgGridModule.withComponents (ProjectUpdateButtonComponent)
],