Reputation: 3353
I have some HTML I get in JSON which needs to be injected into a page. I used $sce.trustAsHtml
and bound the output with ngBindHtml
, but that strips out, apparently, tags like <select>
and <input>
which are "unsafe." Is there some way to tell Angular I really, actually did intend to insert exactly the HTML I asked for into the page?
Right now I just have something like $scope.$watch('response.htmlBody', function(){$('#container').html($scope.response.htmlBody);}
and it seems to work as intended but that seems like a pretty lousy hack.
In this case the HTML is free of Angular-specific elements, so I do not need to worry about compiling it again.
Upvotes: 1
Views: 162