This small directive removes white spaces from an input field.
- Add the directive to the module 'delarations' section.
@NgModule( {
...
declarations: [ ..., InputTrimDirective ],
...
} )
- Add the "trim" attribute to a text input element.
<input type="text" trim />
Good luck.