Tag Archives: modalController – Wikipedia

Ngif of module in ionic 5 + angular

Use ionic5 pop-up box with the following code:

const modal = await this.modalController.create({
      component: MyComponent,
      componentProps: {
        title: option.title || '',
      },
      cssClass: 'my-custom-class'
    });
    await modal.present();
    const { data } = await modal.onDidDismiss();
    return data;

Then there is an ngIf directive in MyComponent, run the error:

Can't bind to 'ngIf' since it isn't a known property

The reason:
Angular routes are not loaded into MyComponent’s Module
Solutions:
1. Import the module of MyComponent in app.module.ts
2. Import the module where the MyComponent resides in the module.ts of the page that uses the pop-up box