Home > Mobile >  Adding a redirection link to an AlertController button
Adding a redirection link to an AlertController button

Time:03-01

(Angular & Ionic) I would like to add a link to the playstore from my alertcontoller modal. is this possible?

    const alert = this.alrtCrtl.create({
      title: `...`,
      subTitle: `...`,
      message: `<div > <img id='...' alt='...' />`,
            buttons: [ {
              cssClass: `cancel-button`,
              text: `X`,
            },
            {
              cssClass: `secure-hub`,
              text: `Go To Play Store`, <<<<<<< this button
            }
          ],
        });
    alert.present();

CodePudding user response:

You can add handler to your button that can call the method to open your playstore link:

buttons: [ {
    cssClass: `cancel-button`,
    text: `X`,
},
{
    cssClass: `secure-hub`,
    text: `Go To Play Store`, //<<<<<<< this button,
    handler: () => {
        this.yourMethodToOpenUrl()
    }
}
  • Related