Skip to content

bug: IonicSafeString encapsulated string shows undefined with alertController.create #28365

Closed as not planned
@elpollodiablo

Description

@elpollodiablo

Prerequisites

Ionic Framework Version

v7.x

Current Behavior

with

const message = 'some text<br/><br/>and html'
const alert = await this.ionicAlert.create({
   message: new IonicSafeString(message),
   ...
});

will produce an alert with "undefined"

With

IonicModule.forRoot({
  innerHTMLTemplatesEnabled: true,
  ...
})

both message: message and new IonicSafeString(message) display interpreted html

Expected Behavior

with

IonicModule.forRoot({
  innerHTMLTemplatesEnabled: false,
  ...
})

message: message displays message as plaintext andnew IonicSafeString(message) displays interpreted html

Steps to Reproduce

  1. create an alertController triggered alert with message: new IonicSafeString('some<br/>htmltext')

Code Reproduction URL

No response

Ionic Info

Ionic:

Ionic CLI : 7.1.1 (/Users/philip/.nvm/versions/node/v18.17.1/lib/node_modules/@ionic/cli)
Ionic Framework : @ionic/angular 7.3.1
@angular-devkit/build-angular : 15.2.9
@angular-devkit/schematics : 15.2.9
@angular/cli : 15.2.9
@ionic/angular-toolkit : not installed

Capacitor:

Capacitor CLI : 4.8.1
@capacitor/android : 4.8.1
@capacitor/core : 4.8.1
@capacitor/ios : 4.8.1

Cordova:

Cordova CLI : not installed
Cordova Platforms : not available
Cordova Plugins : not available

Utility:

cordova-res : not installed globally
native-run (update available: 1.7.3) : 1.7.2

System:

ios-deploy : 1.11.4
ios-sim : 8.0.2
NodeJS : v18.17.1 (/Users/philip/.nvm/versions/node/v18.17.1/bin/node)
npm : 6.14.18
OS : macOS Unknown
Xcode : Xcode 14.3.1 Build version 14E300c

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions