In ionic 2 application, is that possible to add ion-icon in the alert controller like shown below
let showAlertCtrl = this.alertCtrl.create({
title: '<ion-icon ios="ios-add" md="md-add"></ion-icon>' +'Add your info',
cssClass: 'myCustomCSS',
message: msg,
enableBackdropDismiss: false,
buttons: [
{
text: '<ion-icon ios="iOS-search" md="md-add"></ion-icon>' +' Ok',
cssClass: 'customAlertBtn',
handler: (data: any) => {
}
},]
});
showAlertCtrl.present();
Need to display ion-icon image on both title and buttons. Is that possible?
Also I knew that we can use modal to achieve this. But my first priority to check it in alert controller.
Thanks AK
You should use backticks to parse the html:
If you decide to use a modal, you can make it look like an alert with css.For example:
A bit late response. I tried to achieve this today, and I made it like this:
Create a css class in your app.scss and add that class in the alert option "cssClass".
app.scss
These css values can be changed per your requirements.
And in the Alert: