How to insert escape characters or html in modal content


Topic: How to insert escape characters or html in modal content

herve pro asked 4 years ago

In my modals I can add custom content to display (with data parameter), but how can I insert a carriage return into a line ?

I have tried \r\n or<br>but none work.

Is there a way to do that ?

Thank you


Arkadiusz Idzikowski staff answered 4 years ago

<br /> should work correctly, but you would need to use [innerHTML] instead of string interpolation.

data: {
     heading: 'Modal <br /> heading',
 }

In modal template:

<h4 [innerHTML]="heading"></h4>

Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Answered

Specification of the issue
  • User: Pro
  • Premium support: No
  • Technology: MDB Angular
  • MDB Version: 7.4.1
  • Device: desktop
  • Browser: chrome
  • OS: windows 10
  • Provided sample code: No
  • Provided link: No
Tags