0

I have a simple text expansion in my template like so:

<td>{{ someMethodHere() }}</td>

and I want the string that's returned from someMethodHere to include a line-break. I've tried including both \n and <br/> in the returned string but neither is actually evaluated in the resulting HTML.

What's the trick to this?

Gargoyle
  • 9,590
  • 16
  • 80
  • 145
  • you would need to set the `.innerHTML` of the `` tag – mast3rd3mon Apr 10 '18 at 15:19
  • That works, thanks. I added n `[innerHTML]` binding to the `td` tag. If you want to show that in an answer I'll mark it correct. – Gargoyle Apr 10 '18 at 15:26
  • Possible duplicate of [Adding line breaks when using interpolation](https://stackoverflow.com/questions/40746142/adding-line-breaks-when-using-interpolation) – Ayushi Jain Apr 10 '18 at 15:30

1 Answers1

0

If you want to use html markup, you need to set the innerHTML. Something like the following would work using your placeholder function:

<td [innerHTML]="someMethodHere()"></td>

mast3rd3mon
  • 8,229
  • 2
  • 22
  • 46