Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 48978

Migrating Alert from Ionic 3 to Ionic 4

$
0
0

Hi,

I’m trying to migrating a very old Ionic 3 project. I’m still new to Ionic, java and js. This is my original Ionic 3 code using AlertController with a button:

borrarDB()
  {
    this.BTSerial.isConnected().then(() => {

      let alert = this.alertCtrl.create({
        message: 'Error',
        subHeader: 'Bluetooth conectado ',
        buttons: ['OK']
        });
       alert.present();     

    }, () => {
      
      let alert = this.alertCtrl.create({
          message: "Confirmar",
          subHeader: 'Esta seguro?',
          buttons: [
            {
              text: 'No',
              handler: () => {
                console.log('No clicked');
              }
            },
            {
              text: 'Si',
              handler: () => {
                console.log('Si clicked');
                
                this.Save.set ("EqList", "");
                this.Save.clear();
            
                this.Save.set ("EqAlias", "");
                this.Save.clear();
                
                console.log ("Base de datos borrada");                
              }
            }
          ]
        });
        alert.present();
    });

I have changed title and subtitle from Ionic 3 to message and subHeader but my problem is with alert.present() Reading Ionic 4 API there is a new async/await usage for AlertController but not sure how to use them with my original code.

Any help or guidance would be appreciated. Thanks.

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 48978

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>