Ion-alert isOpen

Hi all,

I’m having trouble with ion-alert for some reason. I’m getting errors that say “Can’t bind to ‘isOpen’ since it isn’t a known property of ‘ion-alert’”, when the examples and documentation clearly say that setting isOpen to true should open the dialog.

I’m using Ionic Framework : @ionic/angular 6.3.4
Angular v15.1.4

In an HTML page I have this:

<ion-alert
  [isOpen]="isDeleteAlertOpen"
  header="Confirm deletion of this sound"
  message="Really delete ${selectedButtonName} ?"
  [buttons]="alertButtons"
  (didDismiss)="setResult($event)"
></ion-alert>

In the ts I have this:

  deleteSound(event: Event) {
    console.log('got to deleteSound, buttonName: ' + this.selectedButtonName);
    this.isDeleteAlertOpen = true;
  }

A FAB button calls deleteSound when it’s tapped. I expected the alert to pop up and get a confirmation whether to actually delete the sound file, but nothing pops up.

When my app starts I see this:
E/Capacitor/Console: File: http://localhost/vendor.js - Line 76480 - Msg: NG0303: Can’t bind to ‘isOpen’ since it isn’t a known property of ‘ion-alert’ (used in the ‘Tab1Page’ component template).
1. If ‘ion-alert’ is an Angular component and it has the ‘isOpen’ input, then verify that it is a part of an @NgModule where this component is declared.
2. If ‘ion-alert’ 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.

Anything jump out at you how I’m doing this incorrectly?

Thanks,

Bret

FWIW, I was also not able to open the dialog using the trigger method. I was, however, able to activate the dialog using the Alert Controller.

Why is the inline method using isOpen or trigger the preferred method?

Bret

isOpen was added to ion-alert in Ionic 7.0.0, so you will need to upgrade.

2 Likes