【发布时间】:2021-07-13 16:44:42
【问题描述】:
我收到此错误,
找不到 ModalBackdropComponent 的组件工厂。你把它添加到@NgModule.entryComponents 了吗?
我尝试将 ModalBackdropComponent 添加为 entryComponents,因为这似乎是一个常见问题。我还在最后添加了 forRoot() 。我在角度 8
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { SharedModule } from '../../shared/shared.module';
import { JobsRoutingModule, JobsRoutingDeceleration } from './jobs-routing.module';
import { DragDropModule } from '@angular/cdk/drag-drop';
import { ReactiveFormsModule, FormsModule } from '@angular/forms';
import { NgScrollbarModule } from 'ngx-scrollbar';
import { ModalBackdropComponent, ModalModule } from 'ngx-bootstrap/modal';
import { BsDatepickerModule } from 'ngx-bootstrap/datepicker';
import { BsDropdownModule } from 'ngx-bootstrap/dropdown';
import { PaginationModule } from 'ngx-bootstrap/pagination';
import { OrderModule } from 'ngx-order-pipe';
import { Ng2SearchPipeModule } from 'ng2-search-filter';
import { AutocompleteLibModule } from 'angular-ng-autocomplete';
import { NgxPrintModule } from 'ngx-print';
import { AssignedJobWidgetComponent } from './jobs/assigned-job-widget/assigned-job-widget.component';
const modulesImport = [
DragDropModule,
NgxPrintModule,
BsDatepickerModule.forRoot(),
BsDropdownModule.forRoot(),
PaginationModule.forRoot(),
ModalModule.forRoot(),
];
@NgModule({
declarations: [
JobsRoutingDeceleration,
AssignedJobWidgetComponent
],
imports: [
CommonModule,
JobsRoutingModule,
SharedModule,
ReactiveFormsModule,
FormsModule,
NgScrollbarModule,
OrderModule,
Ng2SearchPipeModule,
modulesImport,
AutocompleteLibModule,
],
entryComponents: [ModalBackdropComponent],
})
export class JobsModule { }
【问题讨论】:
标签: angular