javascript - Change AngularJS ngTrim Behavior -


i using angularjs version 1.5.6. have large application lots of text areas , text inputs. discovered bug today caused default angularjs behavior of trimming input text type inputs. change behavior trimming default not trimming default.

is there easy way rather go through hundreds of textareas , text inputs in application. (perhaps globally or writing own directive?)

here documentation page describing default behavior of ng-trim (ngtrim).

https://docs.angularjs.org/api/ng/input/input%5btext%5d

the below directive should work input type=text fields. set value of ngtrim false default every input field. , similar 1 can created textarea if required.

.directive('input', function($compile){    return {    link(scope, element, attrs) {     if (element.attr('type') === 'text') {       attrs.$set('ngtrim', 'false');     }   }   };  }); 

Comments

Popular posts from this blog

html - How to set bootstrap input responsive width? -

javascript - Highchart x and y axes data from json -

javascript - Get js console.log as python variable in QWebView pyqt -