diff --git a/src/ng/directive/input.js b/src/ng/directive/input.js index cd2f0cfc25ab..a90aa58669d9 100644 --- a/src/ng/directive/input.js +++ b/src/ng/directive/input.js @@ -372,6 +372,14 @@ function textInputType(scope, element, attr, ctrl, $sniffer, $browser) { var listener = function() { var value = trim(element.val()); + // Trim is great but sometimes we need that extra white space. + // To prevent using the trim add the attribute ng-trim with the value of "0" or "off" + // e.g. + if (attr.ngTrim === 'off' || attr.ngTrim == 0) { + value = element.val(); + } + + if (ctrl.$viewValue !== value) { scope.$apply(function() { ctrl.$setViewValue(value);