Saturday, 15 August 2015

javascript - How to disable trimming of inputs in AngularJS? -



javascript - How to disable trimming of inputs in AngularJS? -

i've found unusual behavior: angular trims model values default. , quick googling doesn't help me solve problem. i've found ng-no-trim directive proposals, ng-trim , on. nil works.

i've provided little snippet represents issue below.

class="lang-javascript prettyprint-override">function ctrl($scope) { $scope.text=''; $scope.$watch('text', function (newvalue) { console.log(newvalue); }); }

also seek snippet here.

i've added textarea in sync model text. doesn't react watching when add together new trailing spaces or break line new one.

what turn off behavior? thanks.

the directive in question new in 1.1.1; can see working using js bin snippet.

<textarea cols="30" rows="10" ng-model="text" ng-trim="false"></textarea>

javascript angularjs

No comments:

Post a Comment