Angular2 Pipes: output raw HTML

后端 未结 9 2084
春和景丽
春和景丽 2020-12-13 17:43

I\'m trying to create an Angular2 custom pipe that outputs raw html. I want it to simply convert newlines in the input into HTML line breaks. How do I output raw HTML from a

9条回答
  •  死守一世寂寞
    2020-12-13 18:00

    If you are binding Typescript variable in HTML and it contains '\n' then you need to replace them < br/> otherwise keep < br/> from beginning.

    However String interpolation will not break the line you need to use property binding with innerHtml like:

    
    

提交回复
热议问题