After reading AngularJS tutorial step-9 I have created my own AngularJS filter, which should convert boolean data into html.
Here is my filter code:
angular.module('phonecatFilters', []).filter('iconify', function () { // My custom filter
return function (input) {
return input ? '<i class="icon-ok"></i>' : '<i class="icon-remove"></i>';
}
});
Here is my HTML code:
<dt>Infrared</dt>
<dd>{{phone.connectivity.infrared | iconify }}"></dd>
The problem is that borwser displays returned value literally as:
<i class="icon-ok"></i>
not as icons (or rendered html) that should appear.
I think that some sanitisation occurs during this process.
Is it possible to turn this sanitization off for this specific filter?
Also I know how to display icons by not returning HTML output from filter but rather just 'ok' or 'remove' text which I can then substitute to:
<i class="icon-{{phone.connectivity.infrared | iconify}}"><i>
but this is not what I want.