Is there an angular specific way? If not, should I use the built in jquery to do it? If I should use the built in jquery how do I get to the trim() function without using $ (o
If you need only display the trimmed value then I'd suggest against manipulating the original string and using a filter instead.
app.filter('trim', function () {
return function(value) {
if(!angular.isString(value)) {
return value;
}
return value.replace(/^\s+|\s+$/g, ''); // you could use .trim, but it's not going to work in IE<9
};
});
And then
{{ foo | trim }}