ionic-team / ionic-framework

A powerful cross-platform UI toolkit for building native-quality iOS, Android, and Progressive Web Apps with HTML, CSS, and JavaScript.
https://ionicframework.com
MIT License
51.02k stars 13.52k forks source link

ToastController and AlertController don't work together #7903

Closed alfabetagama closed 8 years ago

alfabetagama commented 8 years ago

Short description of the problem:

If you present Toast and Alert at the same time, Toast does not show. If you try to do that two times in a row, exception is thrown:

EXCEPTION: Expression has changed after it was checked. Previous value: 'false'. Current value: 'true'

What behavior are you expecting?

I would expect Toast to show.

Steps to reproduce:

  1. Call the following code on button click
  2. Press button one time
  3. Cancel or confirm
  4. Press button once more .
toasted() {
        let toast = this.toastCtrl.create({
            message: 'Toasting',
            duration: 6000,
            position: 'center',
            dismissOnPageChange: false
        });
        toast.present();
        let alert = this.alertCtrl.create({
            title: 'Confirmation required',
            message: 'Do you see the Toast?',
            buttons: [
                {
                    text: 'Yes',
                    handler: () => {
                        alert.dismiss().then(() => console.log('Some operation'))
                        return false;
                    }
                },
                {
                    text: 'No',
                    handler: () => {
                        alert.dismiss();
                        return false;
                    }
                }
            ]
        });
        alert.present();
    }

Other information: (e.g. stacktraces, related issues, suggestions how to fix, stackoverflow links, forum links, etc)

Which Ionic Version?

2.0 beta 11

Plunker that shows an example of your issue

Plunker does not support beta 11 so i created git repo, based on Tab starter app:

https://github.com/alfabetagama/toastControllerBug.git

Relevant code is in home.ts and home.html

Run ionic info from terminal/cmd prompt: (paste output below)

Cordova CLI: 6.3.1
Gulp version:  CLI version 3.9.1
Gulp local:   Local version 3.9.1
Ionic Framework Version: 2.0.0-beta.11
Ionic CLI Version: 2.0.0-beta.37
Ionic App Lib Version: 2.0.0-beta.20
OS: Windows 7 SP1
Node Version: v6.4.0
jgw96 commented 8 years ago

Hello, thanks for opening an issue with us! This has actually already been fixed and will be in the beta.12 release. Thanks for using Ionic!

alfabetagama commented 8 years ago

Well, that is good to hear. Thanks.