I have external API data which is a user generated content. The client wants to dynamically update his own site with this feed, including the ability to use JavaScript.
<div ng-bind-html="post.content"></div>
Will display anything that is HTML or CSS but does not work with JavaScript:
"content":"<div>Hello Stack</div><script>alert('whats up?');</script>"
I have tried including ngSanitize
as well as using ng-bind-html-unsafe
.
No dice.
I have external API data which is a user generated content. The client wants to dynamically update his own site with this feed, including the ability to use JavaScript.
<div ng-bind-html="post.content"></div>
Will display anything that is HTML or CSS but does not work with JavaScript:
"content":"<div>Hello Stack</div><script>alert('whats up?');</script>"
I have tried including ngSanitize
as well as using ng-bind-html-unsafe
.
No dice.
Share Improve this question edited Mar 4, 2016 at 15:00 isherwood 61.2k16 gold badges121 silver badges169 bronze badges asked Jul 4, 2013 at 2:27 Dan KanzeDan Kanze 18.6k28 gold badges84 silver badges135 bronze badges1 Answer
Reset to default 6You have to include jQuery for this to work.
After some searching I came across https://stackoverflow./a/14088380/1264846.
Example plunkr: http://plnkr.co/edit/zEXXCB459Tp25VJiyyZb?p=preview
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742420602a4440606.html
评论列表(0条)