AngularJS application:
The ng-model directives bind the input fields to the controller properties.In my application the inputs with spaces are ignored, for example : " A"
,the resulting output is "A"
.
Is there a way to include those white spaces as well ?
Fiddled here
Thanks
You can add the ng-trim="false"
attribute to stop Angular from trimming the extra whitespace in input fields.
Besides that, you also have the additional problem that the whitespace isn't rendered in HTML.
You can fix this for example by using
Full Name: <pre>{{Location + " " + Item}}</pre>
Demo fiddle
Or alternatively by using css:
white-space: pre;
Demo fiddle
Use ng-trim="false"
directive:
<input type="text" ng-model="Location" ng-trim="false">
DEMO: http://jsfiddle.net/pa6sdudd/4/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With