Angular 6 Application Productions build gets successfully but on load throws error No component factory found for t

Jignesh Mistry

I am building a application where when i run the below command it gets generated successfully & also dist folder is created.

ng build --prod --base-href /ICS/

But when i run the application it shows me the login screen as well but when I log in i throws the below error.

Uncaught (in promise): Error: No component factory found for t. Did you add it to @NgModule.entryComponents?
Error: No component factory found for t. Did you add it to @NgModule.entryComponents?

I cannot understand what it this "t" coming from ?

Mahmoud Fawzy

you have some components injected or used in other components so if you are using lazy loading modules then you need to add it to entrycomponents array in the parent lazy loaded module, if not then you need to add it to app module.

also make sure that all entry components added to declaration array.

@NgModule({
  declarations: [
    AppComponent,
    YourComponent
  ],
  imports: [
    BrowserModule,
    FormsModule,
    HttpClientModule,
    AppRoutingModule
  ],
  providers: [],
  entryComponents: [YourComponent]
  bootstrap: [AppComponent]
})

if your entry component in another module, you should export it there first to use it.

exports: [ YourComponent ]

that issue happens alot specially when you use components as popups or dialogs

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Angular 6 setTimeout Module not found: Error: Can't resolve 'timers'

Angular Unit Test Error: No component factory found for Component. Did you add it to @NgModule.entryComponents

Angular Dialog: No component factory found for DialogModule.

No component factory found Error in ionic2 rc0

'No component factory found for [custom component]' in Angular|Ionic

Angular6 -> Build error

angular 6, build can't load images on Firebase hosting

Angular 6 bug in Chrome, function($event) randomly throws error "can't read property "value" of undefined"

Load and unload angular6 component

Error: No component factory found for MatSnackBarContainer

Angular 6 - Module not found: Error: Can't resolve 'http' in

Simple ModalService for Angular 7 does not open: No component factory found for

Why Angular Application throws error after Production Build?

Ionic 4 Popover implementation Error: No component factory found for ProfileComponent

Angular 8: ERROR Error: No component factory found

Angular 6 dom-to-image throws uncaught error (Can't convert html to image)

Angular 8 ngx-bootstrap modal No component factory found

How to fix No component factory found for NgxMaterialTimepickerContainerComponent error?

Angular 9 - No component factory found for <component>

Heroku build successfully but has application error

Angular 8.2 Shared component that extends another component throws No component factory error

Angular 2 RC6 test HTTP.get throws error the get() method doesn't exist

Angular2: No component factory found for function HomeComponent

Angular 6 Docker Build - ERROR in The Angular Compiler requires TypeScript >=2.7.2 and <2.8.0 but 2.8.3 was found instead

Get error in Angular 7 ./src/app/app.component.ts Module not found: Error: Can't resolve

Migrated application to Angular 6 : But getting errors while running npm run build --prod. But command npm run build --env=prod runs successfully

Docker Build throws a file not found error when the file is there

Github can execute workflow successfully but GitHub Pages gets `404 File not found error`

Angular ng build throws error write EPIPE