My FeedDiscussionsHeadless CMS
New
Sign in
Log inSign up
Learn more about Hashnode Headless CMSHashnode Headless CMS
Collaborate seamlessly with Hashnode Headless CMS for Enterprise.
Upgrade ✨Learn more
How to add not allowed whitespace validator in Angular?

How to add not allowed whitespace validator in Angular?

Hardik Savani's photo
Hardik Savani
·Dec 20, 2019

Sometime we need to add validation for no space allow on input field. so here i will give you example of How to validate Whitespace / spaces in angular applicarion?, you can easily use custom validation for Angular No Whitespace Allowed Vaidator for reactive form.

You can easily use this custom validation for no space allowed with angular 6, angular 7, angular 8 and angular 9.

Actually, few days ago i was working on my reactive form and i need to add custom validation for not allow white space. i thought i will use something if condition or anything else. but i found way to create custom validation for rules for this. so i created very simple way for no space allow to input field in angular application.

We will create new custom validator for not contain space on input field. we will not allow space on username. so let's see now it works.

Link: https://www.itsolutionstuff.com/post/angular-form-validation-no-whitespace-allowed-exampleexample.html