How to edit the title of ALL Alerts in the Ionic app, and not just one?

Asked

Viewed 46 times

0

By following the Ionic documentation, I can edit the title of an Alert using the one taught in the following link:insert link description here

However, when Alert is fired from within an iframe, it is shown as a "natural" android Alert, something that doesn’t suit my app. How can I make a change to ALL titles of ALL Alerts, even those that are fired by iframe?

1 answer

0

I made an app using ionic v1 using the same properties as the documentation of ionic v3 and it worked for me. Follow below what I used:

$ionicPopup.confirm({
      title: titulo,
      subTitle: subtitle,
      template: 
      `<style>
        .popup{
          border-radius: 7px !important;
        }
        .popup-head { 
          background: ${backgroundTitulo} !important;
          border-top-left-radius: 7px !important;
          border-top-right-radius: 7px !important; 
        }
        .popup-title {
          color: ${corTitulo} !important;
        }
        .popup-sub-title{
          color: ${corTitulo} !important;
          font-weight: normal;
          font-size: 12pt;
        }
        .popup-body{
          background: ${background} !important;
          /*color:#fff !important;
          font-size:24px !important;*/
          text-align: center;
        }
        .popup-buttons{
          background: ${background} !important;
          border-bottom-left-radius: 7px !important;
          border-bottom-right-radius: 7px !important;
        }
        .popup-buttons .button {
          color: ${corBotaoTexto} !important;
        }
        .popup-buttons .button {
          background: ${corBotao} !important;
          color: ${corBotaoTexto} !important;
          box-shadow: none !important;
          border-radius: 5px !important;
        }
      </style>
      <p>${message}</p>
      `
      ,buttons: [
        { // Array[Object] (optional). Buttons to place in the popup footer.
          text: 'Não',
          type: 'button-default',
          onTap: function(e) {
            if( cancelCallback != null){
              cancelCallback(e);
            }
            return e;
          }
        }, 
        {
          text: 'Sim',
          type: 'button-positive',
          onTap: function(e) {
            if(confirmCallback != null){
              confirmCallback(e);
            }
            return e;
          }
        }
      ]
    });
  };

Note: what is inside ${...}, which is the string interpolator of javascript ES2015, are javascript variables that I define in my code.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.