Ionic 2 beta 9 Alerts (succeeding alert issue)


#1

Hello,

When updating to ionic 2 beta 9, I encountered an issue regarding alerts (it was working in beta 7)

The scenario is I have a prompt alert (Alert A) where it has an input and two buttons (Cancel, Ok).
On click of Alert A’s “Ok”, if the input is invalid, it should prompt a simple error alert (Alert B) which shows the error message and a single button (Ok) to dismiss itself, also Alert A should remain/not be dismissed when Alert B is shown. (so that user can rectify the invalid input in Alert A)

when we upgraded to beta 9, when Alert B is shown, any click on the backdrop or the Alert B’s Ok button will not work (i.e Alert B cannot be dismissed)

simplified code example

let alertA = Alert.create(
  {title:"Hello Alert A", 
   subTitle:"Alert A", 
   buttons:[
      {text:'Cancel'}, 
      {text:'Ok', handler:(data)=>{
               let alertB = Alert.create(
               {title:"Hello Alert B", 
               subTitle:"Alert B", 
               buttons:[{text:'Ok'}]
               });
               this.nav.present(alertB); 
        //return false to not dismiss alert A
        return false;
      }}
   ]
  });
this.nav.present(alertA);

Upon checking, it seems the enabled property of Alert B component wasn’t set which is preventing it to call the button handlers. Upon tracing the code, enabled property is set in its ionViewEnter which wasn’t called… It seems like a bug of navcontroller (?) where Alert B’s fireDidEnter is not called as Alert A’s fireOtherLifecycles property is false.

Thanks


#2

Hi, logged github issue instead (https://github.com/driftyco/ionic/issues/7009), will continue discussion there.