cssClass in Alert not working

Hi, I have the next code

home.page.ts

 const alert = await this.alertController.create({
          header: 'Register Code',
          message: `Code : <strong style="user-select: text;">${res['code']}</strong>`,
          buttons: ['OK'],
          cssClass : 'TextSelectable'
        });

await alert.present();

home.page.scss

.TextSelectable {
    --background: #000000 !important;
    user-select: text;
 
    .alert-message {
        background: red;
    }
}

and not work , but in <ion-alert class="... TextSelectable ..."> there is the class and not work, the styles aren´t in the page

somebody can help me

try moving the declaration of your css-class from home.page.scss to the global ‘global.scss’.

1 Like