I need to replace all _ from a string in my angular app. In my controller, following code gives correct result:
_
alert(\"this_is_string_\".replace(
Just create a dedicated filter :
angular.module('filters.stringUtils', []) .filter('removeUnderscores', [function() { return function(string) { if (!angular.isString(string)) { return string; } return string.replace(/_/g, ''); }; }])
and call it like :