Implementing Password Confirmation with ngPassword

Amit Singh
Jul 22, 2017 · 1 min read

Lets start with installing dependencies.For this project you need angularJS 1.X and ngPassword. You can get ngPassword from github here https://github.com/gdi2290/angular-password

Next declare ngPassword as a dependency angular.module('myapp',['ngPassowrd'])

Don’t forget to put ‘name’ in ‘form’ and ‘input’ elements.Notice second input has an attribute match-password="newPassword" . This attribute will match the content of the input field with name = 'confirmPassword' with the content of input with name = 'newPassword'.

Once again ‘name’ is important.

Put ng-message = 'passwordMatch' in the ng-messages followed by your custom message for unmatched passwords and voila! now you can have confirm password feature on your website too.

Amit Singh

Written by

Frontend Developer at CoinSwitch , Solo Traveller

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade