why white space are getting ignored in AngularJS application

angularjs, javascript

Solution

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

Problem

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

Original source

Related problems