Here is my angularjs
code for the password field :
<input type="password" class="form-control" name="password" ng-model="signup.registerPassword" ng-minlength="8" >
<small class="errorMessage" data-ng-show="signupForm.registerPassword.$dirty && signupForm.registerPassword.$error.minlength"> Minimum 8 characters.</small>
<small class="errorMessage" data-ng-show="signupForm.registerPassword.$dirty && signupForm.registerPassword.$error.required"> Enter password again.</small>
when I type the password below 8 character it is not showing any error.
what is the mistake I am doing and how can I fix it ?
registerPassword
is ng-model
value. signupForm
will have its field inside it by there name attribute. As you are gave name="password"
to your field having password
field in it not form, Then internally angular places the password
field inside signupForm
scope variable.
Change signupForm.registerPassword
to signupForm.password
Markup
<small class="errorMessage" data-ng-show="signupForm.password.$dirty && signupForm.password.$error.minlength"> Minimum 8 characters.</small>
<small class="errorMessage" data-ng-show="signupForm.password.$dirty && signupForm.password.$error.required"> Enter password again.</small>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.