1

I'm using this pluign, on ionic 3, so I'm in lazy loading. I imported the module in my page

.module.ts :

import { NgModule} from '@angular/core';
import { IonicPageModule } from 'ionic-angular';
import { NPage } from './nuovo-precario-fuori-graduatoria';
import { SelectSearchableModule } from 'ionic-select-searchable';
@NgModule({

  declarations: [
    NPage
  ],
  imports: [
    IonicPageModule.forChild(NPage),
    SelectSearchableModule
  ],
})
export class NPageModule {}

Then here the html :

 <ion-item >
    <ion-label>Co</ion-label>
    <select-searchable item-content 
      #selection 
      *ngIf="pa && pa.length>0" 
      margin-right 
      [(ngModel)] = "user"
      itemValueField="code"
      itemTextField="description"
      [items]="pa"
      [canSearch]="true"
      (onChange)="countryChange($event)">
    </select-searchable>
  </ion-item>

I populate the array with some objects, but when I go to click on the dropdwon select icon I have this error:

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

  • DId you try adding the component to `entryComponents` as suggested? – David Sep 13 '18 at 10:37
  • You have only single module in project or working with multiple modules? – Paresh Gami Sep 13 '18 at 10:42
  • @PareshGami I have a lot of modules –  Sep 13 '18 at 11:10
  • . @David entryComponents in my page.module.ts or app.module.ts? –  Sep 13 '18 at 11:10
  • To the the page.module.ts – David Sep 13 '18 at 14:04
  • Nope to do...... –  Sep 13 '18 at 14:36
  • Does this answer your question? [Angular 4: no component factory found,did you add it to @NgModule.entryComponents?](https://stackoverflow.com/questions/46990389/angular-4-no-component-factory-found-did-you-add-it-to-ngmodule-entrycomponent) – canbax Nov 25 '19 at 06:32
  • @canbax nope.I solved by removing the lazy loading on this page, so delete mypage.module.ts, declare and put in entryComponents on app.module.ts . I put just SelectSearchableModule in imports of app.module.ts and it works, but is not more LAZY LOADING !!! –  Nov 25 '19 at 11:39

1 Answers1

1

Try Some thing like this:

@NgModule({

  declarations: [
    NPage
  ],
  imports: [
    IonicPageModule.forChild(NPage),
    SelectSearchableModule
  ],
  entryComponents: [
    SelectSearchablePageComponent
  ]
})
export class NPageModule {}
Sudarshana Dayananda
  • 5,165
  • 2
  • 23
  • 45
  • I got this: Uncaught Error: Component SelectSearchablePageComponent is not part of any NgModule or the module has not been imported into your module. –  Sep 13 '18 at 11:16
  • 1
    Add `SelectSearchablePageComponent` to your imports array in your app.module.ts as well. – Sudarshana Dayananda Sep 13 '18 at 11:19
  • I got this: Uncaught Error: Unexpected directive 'SelectSearchablePageComponent' imported by the module 'AppModule'. Please add a @NgModule annotation. –  Sep 13 '18 at 11:20
  • Sorry Not to `imports` array to `declarations` array. – Sudarshana Dayananda Sep 13 '18 at 11:25
  • I got this error ERROR Error: Uncaught (in promise): Error: Type SelectSearchablePageComponent is part of the declarations of 2 modules: AppModule and SelectSearchableModule! Please consider moving SelectSearchablePageComponent to a higher module that imports AppModule and SelectSearchableModule. You can also create a new NgModule that exports and includes SelectSearchablePageComponent then import that NgModule in AppModule and SelectSearchableModule –  Sep 13 '18 at 11:31
  • And this : Error: Type SelectSearchablePageComponent is part of the declarations of 2 modules: AppModule and SelectSearchableModule! Please consider moving SelectSearchablePageComponent to a higher module that imports AppModule and SelectSearchableModule. You can also create a new NgModule that exports and includes SelectSearchablePageComponent then import that NgModule in AppModule and SelectSearchableModule. –  Sep 13 '18 at 11:32
  • 1
    Ok. remove `SelectSearchablePageComponent` from your `declarations` array and add `SelectSearchableModule` to imports array of your AppModule. – Sudarshana Dayananda Sep 13 '18 at 11:34
  • Ok, but I'm in lazy loading. –  Sep 13 '18 at 12:15
  • Ok. Is your app working now? If you are in lazy loading I think David's Answer will work. – Sudarshana Dayananda Sep 13 '18 at 12:27
  • No. ERROR Error: Uncaught (in promise): Error: Template parse errors: Can't bind to 'items' since it isn't a known property of 'select-searchable'. 1. If 'select-searchable' is an Angular component and it has 'items' input, then verify that it is part of this module. 2. If 'select-searchable' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message. 3. To allow any property add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component. (".... –  Sep 13 '18 at 12:28
  • Did you try David's answer? – Sudarshana Dayananda Sep 13 '18 at 12:30
  • not lazy loaded doesn't works, but the other want I have to read to understand what to do. You know? –  Sep 13 '18 at 12:34
  • Ok give me 1 min to compile –  Sep 13 '18 at 12:42
  • Omg this error : ERROR Error: Uncaught (in promise): Error: No component factory found for SelectSearchablePageComponent. Did you add it to @NgModule.entryComponents? .... Let me try again –  Sep 13 '18 at 12:46
  • Can you add sample of your app to https://stackblitz.com/edit/ionic-kobtmf then I can help you. – Sudarshana Dayananda Sep 13 '18 at 12:49
  • This is not lazy loaded, anyway I'm using the plugin, I don't know how to integrate .https://github.com/eakoriakin/ionic-selectable –  Sep 13 '18 at 12:52
  • No way ... ERROR Error: Uncaught (in promise): Error: No component factory found for SelectSearchablePageComponent. Did you add it to @NgModule.entryComponents? –  Sep 13 '18 at 12:52
  • 2
    I deleted my answer. I created a stackblitz with the module and it seems to work. @Cristian: maybe edit it if I missed something https://stackblitz.com/edit/ionic-ugix2k?file=pages%2Fhome%2Fhome.ts – David Sep 13 '18 at 12:57
  • Thank you David. Anyway yes I know it works, but this is not lazy loaded. There is no home.module.ts. In fact this is my problem. In app.module.ts I can't put the searchable module. It doesn't works –  Sep 13 '18 at 12:59
  • I solved by removing the lazy loading on this page, so delete mypage.module.ts, declare and put in entryComponents on app.module.ts . I put just SelectSearchableModule in imports of app.module.ts and it works, but is not more LAZY LOADING !!! –  Sep 13 '18 at 13:53