Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70435

How to update ion-icon inside ActionSheetController Button?

$
0
0

@Sweg wrote:

In my Ionic 5 app, I am displaying some buttons inside an ActionSheetController:

Here is my latest code:

onMechanicClick(mechanicId: string) {
    this.actionSheetCtrl.create({
      header: 'Choose an Action',
      buttons: [
        {
          text: 'Book Appointment',
          icon: 'calendar-outline',
          handler: () => {
            this.goToProfile(mechanicId);
          }
        },
        {
          text: 'Call Me',
          icon: 'call-outline',
          handler: () => { }
        },
        {
          text: 'Message Me',
          icon: 'mail-outline',
          handler: () => {
            this.goToConversationDetail(mechanicId);
          }
        },
        {
          text: 'Cancel',
          role: 'cancel',
          icon: 'close-outline',
          handler: () => { }
        },
      ]
    }).then(actionSheetEl => {
      actionSheetEl.present();
    });
  }

I would like to assign the danger color to the text & icon inside the Cancel button.

I tried creating a CSS class & assigning it below, but that is not resulting in any change.

Can someone please tell me what changes are required to do this?

{
    text: 'Cancel',
    role: 'cancel',
    icon: 'close-outline',
    cssClass: 'cancel',
    handler: () => { }
}

Component CSS:

.cancel {
color: red;
}

I also tried to put this CSS into App Component CSS, but that doesn’t work either.

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 70435

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>