After reading Step by Step on AngularJS step 9, I created my own AngularJS filter, which should convert logical data to 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 the return value literally as:
<i class="icon-ok"></i>
not like the icons (or html displayed) that should appear.
Here is a JSFiddle example
I think that during this process a certain sanitation arises.
Is it possible to disable this cleanup for this particular filter?
I also know how to display icons without returning HTML output from the filter, but simply โgoodโ or โdeleteโ the text, which I can then replace with:
<i class="icon-{{phone.connectivity.infrared | iconify}}"><i>
but thatโs not what I want.
angularjs
Pavel Kostenko Nov 06 2018-12-12T00: 12Z
source share