18

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 ?

1 Answer 1

47

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.