How to allow html in return of angular2 pipe?

前端 未结 3 1123
故里飘歌
故里飘歌 2020-12-03 04:31

I have a pipe that returns a html string, however the string outputs escaped presumably as a default for security. I\'m sure there must be an option to allow html instead bu

3条回答
  •  囚心锁ツ
    2020-12-03 04:46

    So thanks for replies.

    Using the outerHTML binding suggested by @alexpods worked a treat. Didn't need to change my pipe at all.

    So what I was doing before:

    {{'TEXT' | hn: 'h2.whatever'}} which resulted in the correct html but escaped ie.

    <h2 class="whatever">TEXT</h2>

    Works great as:

    which outputs:

    TEXT

提交回复
热议问题