<form name="regForm">
<input type="text" id="username" name="username" ng-model="username" required>
<button ng-click="submitSignup()" type="submit" ng-disabled=" (regForm.username.$dirty && regForm.username.$invalid) || regForm.username.$pristine">Sign Up</button>
</form>
I want the input field to be invalid and the sign up button disabled whenever one presses white space. I don't want to allow white space in the input field either by typing or by pasting. The sign up button should be disabled whenever there is a white space either by typing or by pasting. Can someone help me out on this?