Skip to content

aot and No component factory found for DeviceSelectComponent. Did you add it to @NgModule.entryComponents? #1430

Open
@farfromrefug

Description

@farfromrefug

I can't make my app work with aot.
In my app I have a component that I want to show within a modal dialog.
I define my component within a shared.module.ts

import { NgModule, NO_ERRORS_SCHEMA } from "@angular/core";
import { DeviceSelectComponent } from "~/deviceselect/DeviceSelectComponent";
import { NativeScriptCommonModule } from "nativescript-angular/common";
import { NativeScriptLocalizeModule } from "nativescript-localize/angular";
import { ModalDialogService } from 'nativescript-angular/modal-dialog';

import { CapitalizePipe } from "~/pipes/CapitalizePipe";
import { LocalizePipe } from 'nativescript-localize/angular';
@NgModule({
    imports: [
        NativeScriptCommonModule,
        NativeScriptLocalizeModule
     ],
     entryComponents: [DeviceSelectComponent],
     declarations: [
        DeviceSelectComponent, CapitalizePipe
    ],
    exports: [
        DeviceSelectComponent, CapitalizePipe, LocalizePipe
    ],
    providers: [ModalDialogService],

    schemas: [NO_ERRORS_SCHEMA]
})
  
export class SharedModule {}

But with aot enabled I get

Error: No component factory found for DeviceSelectComponent. Did you add it to @NgModule.entryComponents?

whenever I try to show the modal dialog.
I tried almost every possible solutions:

  • put entryComponents in the modules declarations of the components I am showing the modal from
  • put entryComponents in the app module
  • differents packages versions for nativescript-angular, nativescript-dev-webpack

Nothing works. Any help would be appreciated
Thanks

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions