Company logo
  • Jobs
  • Bootcamp
  • About Us
  • For professionals
    • Home
    • Jobs
    • Courses
    • Questions
    • Teachers
    • Bootcamp
  • For business
    • Home
    • Our process
    • Plans
    • Assessments
    • Payroll
    • Blog
    • Sales
    • Calculator

0

88
Views
How to change input text to lowercase in AngularJS

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

7 months ago · Juan Pablo Isaza
1 answers
Answer question

0

you can use method 'onchange' in your input and create a function and use method toLowercase (https://www.w3schools.com/jsref/jsref_tolowercase.asp)

7 months ago · Juan Pablo Isaza Report
Answer question
Find remote jobs