angular.js ng-repeat li items with html content

前端 未结 7 1758
挽巷
挽巷 2020-12-13 18:34

I have a model that comes back from the server which contains html instead of text (for instance a b tag or an i tag)
when I use ng-repeat to built a list out of it i

7条回答
  •  忘掉有多难
    2020-12-13 19:19

    You can use NGBindHTML or NGbindHtmlUnsafe this will not escape the html content of your model.

    http://jsfiddle.net/n9rQr/

    • {{ opt.text }}

    {{opt}}

    This works, anyway you should be very careful when using unsanitized html content, you should really trust the source of the content.

提交回复
热议问题