在 ionic 2 中将 class 名称添加到 div

Add class name into div in ionic 2

我使用警报组件我需要将 class 名称插入 animated zoomIn<div class="alert-wrapper"></div>

附近的 div

可能吗?

doAlert() {
      let alert = Alert.create({
        cssClass: 'animated zoomIn',
        title: 'New Friend!',
        message: 'Your friend, Obi wan Kenobi, just approved your friend request!',
        buttons: ['Ok']
      });
      this.nav.present(alert);
    }

如果你也想要一些定制,那就试试这个 只需像这样创建您的警报:

let alertPopup = Alert.create({
title: 'title',
subTitle: 'message',
cssClass: 'animated_zoomIn',
buttons: [{
text: 'btnType',
cssClass: 'buttoncss'
}]
});
this.nav.present(alertPopup);

In your app.core.scss or your page scss, define your cssClass like this:

.buttoncss{
color:#e74c3c;
/*Any other style you wish to apply*/
}

.animated_zoomIn{
color:#e74c3c;
/*Any other style you wish to apply*/
}

----Make sure your page scss is imported----