I need a filter to replace all the underscores to spaces in a string
string.replace
not only accepts string as first argument but also it accepts regex as first argument. So put _
within regex delimiters /
and aslo add g
modifier along with that. g
called global modifier which will do the replacement globally.
App.filter('underscoreless', function () { return function (input) { return input.replace(/_/g, ' '); }; });
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With