Is there any way prevent angular version earlier 1.3.0 from auto trim for fields in the whole application? I know that I can prevent it for specified field using ngTrim directiv
In Angular prior to 1.3.x you can try to decorate compile function:
app.config(function($provide) {
$provide.decorator('inputDirective', function($delegate) {
var directive = $delegate[0];
directive.compile = function(orig) {
return function(element, attrs, transclude) {
attrs.$set('ngTrim', 'false');
return orig.apply(null, arguments);
};
}(directive.compile);
return $delegate;
});
});
This approach should also work in 1.3.x though.
Demo: http://plnkr.co/edit/gvIa7omiFWwoWW9tyl4S?p=preview