Render html string within a template using interpolation?

后端 未结 2 1395
礼貌的吻别
礼貌的吻别 2021-02-19 16:04

Using Angular 4.3.0

Say I have a string like this that is a property of a component.

test#2 bla bla

test1234 56

相关标签:
2条回答
  • 2021-02-19 16:44

    You shoud write the parameter as a string.

     <div [innerHTML]="'test here'"></div>
    
    0 讨论(0)
  • 2021-02-19 16:57

    You need to pass your [innerHTML] as a string wrap it with single quotes, <div [innerHTML]="'<b>test here</b>'"></div>

    0 讨论(0)
提交回复
热议问题