I have a div tag in my view:
<div ng-bind-html="investmentVm.item.embed_code"></div>
And in my controller, I get script tag from database and put it in to model:
this.item.embed_code = this.$sce.trustAsHtml("<script>alert('OK');</script>");
If I put a html tag at the end of embed_code, it can be displayed by ng-bind-html, but script tag does not display.
In the old version of AngularJS we can use ng-bind-html-unsafe to bind a script tag but it has been removed in new version.
How can I add a script tag and run javascript code inside just like:
<script type="text/javascript">(function(n){
//Do something here
});</script>
embed-codeinto a template and load it into an iframe. This is not a good solution but it work fine for my case :)