Friday, May 17, 2024
 Popular · Latest · Hot · Upcoming
185
rated 0 times [  189] [ 4]  / answers: 1 / hits: 17020  / 12 Years ago, fri, september 14, 2012, 12:00:00

I made a filter just to add an antislash after a value if another given value is not empty and I would like to separate this antislash from the rest of the string with   .
Actually the filter itself work but right the string   as is in the page.



angular.module('ngMod', []).
filter('antislash', function() {
return function(input) {
if( input==null || input.length === 0 ){
return null;
}else{
return ' / ';
}
}
});


It displays in the page :  / 



Does exist an html filter or something equivalent ?


More From » html

 Answers
68

It works by giving the unicode value for  .



angular.module('ngMod', []).
filter('antislash', function() {
return function(input) {
if( input==null || input.length === 0 ){
return null;
}else{
return 'u00A0/u00A0';
}
}
});


You can also use $sanitize with ng-bind-html and ng-bind-html-unsafe to output html snipets.


[#83079] Wednesday, September 12, 2012, 12 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
leiaf

Total Points: 10
Total Questions: 101
Total Answers: 84

Location: Guam
Member since Tue, Nov 29, 2022
1 Year ago
;