Recently I have converted an ASP.NET Core 2.0 Angular app to ASP.NET Core 2.1 (later one uses angular/cli
app). In the previous version I had some modal components built with ngx-bootstrap which were working correctly. But after conversion those components stopped working and started throwing this error -
No component factory found for {component}. Did you add it to @NgModule.entryComponents?
I have added following to my app.module.ts file -
@NgModule({
imports: [
ModalModule.forRoot(),
MySubModule
],
entryComponents: [
MyModalComponent
]
})
In my MySubModule
-
@NgModule({
declarations: [
MyModalComponent
],
imports: [
ModalModule.forRoot()
]
exports: [
MyModalComponent
]
})
Even though I have defined my entry component it's throwing this error. Can anyone suggest any solution?
It was actually a silly problem. I was only looking at my code but the problem was caused by some files that were in ClientApp/dist
directory. So the application was pulling those files instead of picking up the ng serve
files. So, any changes I was making to my files were not getting picked up. Deleting everything from dist folder fixed the issue.