Why Call Alert is not working properly


doRadio() {
    let alert = Alert.create();
    alert.setTitle('Lightsaber color');

      type: 'radio',
      label: 'Blue',
      value: 'blue',
      checked: true

      text: 'OK',
      handler: data => {
        this.testRadioOpen = false;
        this.testRadioResult = data;

I have above code in .ts file and in html I have below code

	  <ion-label>Exam type</ion-label>
	  <ion-select [(ngModel)]="catSelected" (ionChange)="catselected(catSelected)">
		<ion-option *ngFor="#item of items;#i=index" value="{{i}}">{{item}}</ion-option>

When I change the value of Select menu, It shows Alert with radio. But When I click on OK, it is not working. Alert dialogue box does not disappears.

But if I simply call doRadio from a button click, it works fine. What is the problem ?

1 Like

The reason for this is most likely because you are triggering a new animation when the last one has not completed. I would recommend that you rather use a promise to open the alert that way the view has time to catch-up and register the alerts event listeners. This code should help you:

alert.dismiss().then(() => {
     this.testRadioOpen = false;
     this.testRadioResult = data;

Thanks for the answer smity.
It really helped me to solve my issue :slight_smile:
i am just posting link to my issue so that others can get benifit from it :wink: