1

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 ?

1
  • The above password rule is not working, i.e., it is not showing error messages Commented Aug 29, 2015 at 8:40

1 Answer 1

1

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>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.