0

The errror:

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

My app.module.ts:

@NgModule({
  declarations: [
    //
  ],
  imports: [
    //
    ComponentsModule,
    //
  ],
  bootstrap: [IonicApp],
  entryComponents: [
    //
  ],
  providers: [
    //
  ]
})

My component.module.ts:

@NgModule({
    declarations: [LangPopComponent], // here too
    entryComponents: [LangPopComponent], // see it's imported here
    imports: [
        TranslateModule,
        IonicModule
    ],
    exports: [LangPopComponent], // I well exported this component...
    providers: [
    ]
})
export class ComponentsModule {}

in another page.ts (homepage):

export class HomePage {

  constructor(public popoverCtrl: PopoverController, public translate: TranslateService, public navCtrl: NavController) {
  }

  PresentPopover(){
    let popover = this.popoverCtrl.create(LangPopComponent);
    popover.present(); // ERROR HERE
  }
}

The error is produced when I want to present the component with the popover library provided by Ionic. Any ideas?

Ritwick Dey
  • 18,464
  • 3
  • 24
  • 37
Izio
  • 378
  • 6
  • 15

1 Answers1

0

Insert ComponentsModule in home.module.ts

import { ComponentsModule } from '../components/components.module';


    imports: [
        ComponentsModule
      ],
Gurbela
  • 1,184
  • 2
  • 16
  • 40
  • Same error here. `import { ComponentsModule } from '../../components/components.module'; @NgModule({ imports: [ ComponentsModule ], declarations: [ LangPopComponent ], entryComponents: [ LangPopComponent ], exports: [ LangPopComponent ] })` – Izio May 17 '18 at 20:11
  • He does not see it `'../../components/components.module'` Fix the address – Gurbela May 17 '18 at 20:16
  • https://i.gyazo.com/da805eb2b091ad433ad7681f45e104ec.png It does. And the error would not be this. Any other ideas? – Izio May 17 '18 at 20:39
  • If I add to @NgModule.entrypoints and .declarations in the app.module.ts it's working like a charm. Why it would not be working in another module which are imported in the app.module.ts... :-( – Izio May 17 '18 at 20:43