I want to have an input field to take email from the user for login. I already have all the email validations applied. But now I want to convert the text to lowercase as soon as the user inserts the email.
<div class="form-group mb-3">
<div class="">
<input name="email" class="form-control required" type="email" required placeholder="Email ID" ng-pattern="emailFormat" ng-model="admin.username">
</div>
<span style="color: red" class="error" ng-show="loginForm.email.$error.pattern">
Please enter a valid email
</span>
</div>
//Email format
$scope.emailFormat = /^[a-z]+[a-z0-9._\-]+@[a-z0-9\-]+\.[a-z0-9.]{2,5}$/;
Anyone can please help me how can I convert the upper case letter to lowercase directly in the ng-model? Thanks
you can use method 'onchange' in your input and create a function and use method toLowercase (https://www.w3schools.com/jsref/jsref_tolowercase.asp)