My current dilemma involves utilizing external API data that consists of user generated content. My client's request is to dynamically update their website with this feed, while also allowing the use of JavaScript.
<div ng-bind-html="post.content"></div>
The following code snippet will render anything that includes HTML or CSS, but unfortunately does not support JavaScript:
"content":"<div>Hello Stack</div><script>alert('whats up?');</script>"
I have attempted solutions such as integrating ngSanitize
and using ng-bind-html-unsafe
, however, none of these methods have proven successful.
My efforts have been in vain.