Applying filters on outputted HTML for AngularJS
If you have a standard interpolation in your HTML, Angular will escape it:
<div> {{ var | filter1 | filter2 }} </div>
The result of the whole expression will be escaped.
What you want is ng-bind-html-unsafe
(docs here). You can expression basically the same thing as above as:
<div ng-bind-html-unsafe='var | filter1 | filter2'></div>
Now the result of the expression won't be sanitized, and will be inserted as the contents of the div.
EDIT: Note that there's also ng-bind-html
, which will still produce HTML, but will sanitize it first ($sanitize
docs).
ng-bind-html
lives in the ngSanitize
module, so you'll have to make sure that you've declared it as a dependency in your angular.module
call.