ModalController, passing HTML to a modal

Hello. I am new to ionic, I’ve search your forums for any similar topic but found none.
I have an app where i show a modal following this documentation:
https://ionicframework.com/docs/api/components/modal/ModalController/

Here is some example code i am using:

let Title = "My Title";
let Message = "<b>The Modal Message</b>";
let buttonText = "Continue";

let paramsData = {Title,Message,buttonText}
let profileModal = this.modalCtrl.create(QuestionMessagePage, { paramsData: paramsData });
profileModal.present();

The modal works fine, however, as you can see, Message contains HTML, when the modal appears, it shows:
<b>The Modal Message</b>

instead of
The Modal Message

Thanks

UPDATE: I was able to figure out the solution. All I needed to do was use [innerHTML]="" in my html template

<p [innerHTML]="paramsData.Message"></p>

1 Like