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

networking - Vagrant-provisioned VirtualBox VM is not reachable from Ubuntu host -

c# - ASP.NET Core - There is already an object named 'AspNetRoles' in the database -

ruby on rails - ArgumentError: Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true -