Ionic 2 Alert customization

后端 未结 5 1375
有刺的猬
有刺的猬 2020-12-18 14:06

I want to customize my alerts in Ionic 2. I know that I can do it globally in the variables.scss, but I want to modify a specific one, in a specific page.

I tried cs

5条回答
  •  渐次进展
    2020-12-18 14:23

    Adding the styles in app.css and calling it in page.ts

    showAlert() {
        let alert = this.alertCtrl.create({
          title: 'New Friend!',
          subTitle: 'Your friend, Obi wan Kenobi, just accepted your friend request!',
          buttons: ['OK'],
          cssClass: 'alertCustomCss'
        });
        alert.present();
    }
    

    In App.css

    .alertCustomCss{
      background-color: white;
      color: blue;
      button{
          color: blue;
      }
    }
    

提交回复
热议问题