1.3.0 • Published 8 years ago
angular-iran-national-id v1.3.0
Iranian National ID input directive
AngularJS 1.x directive that will validate an IRANIAN national ID and impose relevant character and structure limits.
Live Demo
View a live demo here!
Installation
npm install --save angular-iran-national-idor
bower install --save angular-iran-national-idUsage
Include dist/angular-iran-national-id.js or dist/angular-iran-national-id.min.js in your build or directly with a <script> tag and inject the module in your module definition:
angular
.module('App', [
'angular-iran-national-id',
... // other dependencies
]);<input type="text" ng-model="model" maxlength="10" minlength="10" islet-iran-national-id />Failing one of the validation rules will cause the input to become invalid and gain the ng-invalid-iran-national-id class. Valid entries will have ng-valid-iran-national-id class.
Features
Limits User Input
- Characters limited to numbers only
- Max & Min restrictions (to 10 digits), can be achieved by angular native directives:
ng-maxlenghtandng-minlenght
Validates User Input
- Check-digit validation with official algorithm
- Same digits entry restriction (e.x: The numbers such as
1111111111and6666666666are not allowed!)
Todos
- Format code in human-readable style (ex: xxx-xxxxxx-x)