Angular directive for the library zxcvbn
npm install angular-zxcvbn
This is a simple directive for the zxcvbn library.
Install with bower:
``bash`
bower install zxcvbn angular-zxcvbn
Include the following javascript source files:
`html`
Add zxcvbn as an angular dependency. E.G. If your module is called myApp then you would do:`javascript`
angular.module('myApp', ['zxcvbn']);
##### Attribute
Live plunker:
The main way to use the directive is as an attribute alongside the ng-model attribute:`html`$scope.passwordStrength
This will set to the result of calling the zxcvbn function on $scope.userPassword.
---
##### Extras
The directive has an optional attribute of zx-extras. This takes either an array or an angular form object, which will be passed as the optional argument to the zxcvbn call.
> The optional argument is an array of strings that zxcvbn will treat as an extra dictionary. This can be whatever list of strings you like, but is meant for user inputs from other fields of the form, like name and email. That way a password that includes a user's personal information can be heavily penalized. This list is also good for site-specific vocabulary — Acme Brick Co. might want to include ['acme', 'brick', 'acmebrick', etc].
-- zxcvbn readme.md
Example:
`html`zx-extras
We pass the value myForm, which is the value of the name attribute of the parent