我正在尝试使用angular bootstrap设置一个简单的模态。但我正在遇到这个错误:
"ERROR Error: No component factory found for ModalContentComponent. Did you add it to @NgModule.entryComponents?
at noComponentFactoryError"
我已经导入了模块,但仍无法使其正常工作。我已经开始使用文档HERE,并查看了StackOverflow问题HERE。
这是我的app.module:
import { FormPoster } from './services/form-poster.service';
import { DatepickerModule } from 'ngx-bootstrap/datepicker';
import { ButtonsModule } from 'ngx-bootstrap/buttons';
import { RatingModule } from 'ngx-bootstrap/rating';
import { AddGameComponent } from './add-game/add-game.component';
import { ModalModule } from 'ngx-bootstrap';
@NgModule({
declarations: [
AppComponent,
EmployeeComponent,
EmployeeTitlePipe,
EmployeeListComponent,
EmployeeCountComponent,
HomeComponentComponent,
PageNotFoundComponent,
AddEmployeeComponent,
AddGameComponent,
],
imports: [
BrowserModule,
BrowserAnimationsModule,
FormsModule,
HttpModule,
ButtonsModule.forRoot(),
RatingModule.forRoot(),
ModalModule.forRoot(),
DatepickerModule.forRoot(),
RouterModule.forRoot(appRoutes)
],
providers: [EmployeeService, FormPoster],
bootstrap: [AppComponent]
})
export class AppModule { }
答案 0 :(得分:1)
在模块文件中的ModalContentComponent
内添加entryComponent
。
如下:
entryComponents: [
ModalContentComponent
]
答案 1 :(得分:-1)
将组件作为setnames(B, "contract", "contract.name")
A[B, on="contract.name", bid:=bid]
A[is.na(bid), bid:=0][, bid]
并在entryComponents
中添加到模块中。