Angular.js: spaces at the end of an input field bound with ng-model are not working correctly

Created on 14 Feb 2013  路  1Comment  路  Source: angular/angular.js

Hello,

given an input field with ng-model="name", the scope is not updated when you add spaces to the end of the input field.

Please have a look at: http://jsfiddle.net/jrieks/rjf4Q/

-Jens

Most helpful comment

By default AngularJS will trim input's content before binding it to the model. Starting from 1.1.1 (https://github.com/angular/angular.js/blob/master/CHANGELOG.md#111-pathological-kerning-2012-11-26) you can opt-out from this default trimming by using the ng-trim="false" attribute:
http://jsfiddle.net/PhxL2/

>All comments

By default AngularJS will trim input's content before binding it to the model. Starting from 1.1.1 (https://github.com/angular/angular.js/blob/master/CHANGELOG.md#111-pathological-kerning-2012-11-26) you can opt-out from this default trimming by using the ng-trim="false" attribute:
http://jsfiddle.net/PhxL2/

Was this page helpful?
0 / 5 - 0 ratings