AngularJS - Render HTML tags that are contained in a string

后端 未结 2 895
猫巷女王i
猫巷女王i 2020-12-17 11:11

My database stores product information, and a lot of this is organised into lists. I load the data into Angular as $scope.post.

For instance,



        
相关标签:
2条回答
  • 2020-12-17 11:19

    As Damax has said here: https://stackoverflow.com/a/11640420/769083

    <div ng-bind-html-unsafe="post.size_description"></div>
    
    0 讨论(0)
  • 2020-12-17 11:38

    ngBindHtml worked for me. See more in the docs here: https://docs.angularjs.org/api/ng/directive/ngBindHtml

    <div ng-bind-html="post.size_description"></div>
    
    0 讨论(0)
提交回复
热议问题