Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

No component factory found for... Opening a Modal

I have one page that should be loaded inside a modal, this page is child from other page (I think it does not matter, but...) the point is that when I try to create a modal I receive the error below

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

But, when I go to my AppModule to put that page into the entryComponents I got this error:

Component TarefasDetalhePage is not part of any NgModule or the module has not been imported into your module.

The call of the modal is on my HomePage.ts:

  async showModal(id){
    const modal = await this.modalController.create({
     component: TarefasDetalhePage,
     componentProps:{
       custom_id: id
     }
    });
    modal.present();
  }

Here's the markup:

    <ion-list *ngIf="interna === true" >
    <ion-item (click)="showModal(tarefa.id)"   routerDirection="forward" detail *ngFor="let tarefa of tarefasInternas" class="in-list item ion-focusable item-label hydrated">
      <ion-label>
        <h2>#{{tarefa.numero}} - {{tarefa.descricao}}</h2>
        <h3>{{tarefa.inicio}} - {{tarefa.fim}}</h3>
        <p>{{tarefa.comentarios}}</p>
      </ion-label>
    </ion-item>
  </ion-list>

That's my Structure:

enter image description here

Repo on github: https://github.com/tiagosilveiraa/PManager

like image 623
Tiago Silveira Avatar asked Mar 06 '19 01:03

Tiago Silveira


1 Answers

For opening a component in a modal, you have to add the component in the app.module.js as a entryComponent.

Your error message shows that.

like image 126
Kuldeep Bhimte Avatar answered Oct 24 '22 10:10

Kuldeep Bhimte