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, ' ');
};
});
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…