angular-iran-national-id

1.3.0 • Public • Published

Build Status

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-id

or

bower install --save angular-iran-national-id

Usage

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-maxlenght and ng-minlenght

Validates User Input

  • Check-digit validation with official algorithm
  • Same digits entry restriction (e.x: The numbers such as 1111111111 and 6666666666 are not allowed!)

Todos

  • Format code in human-readable style (ex: xxx-xxxxxx-x)

Package Sidebar

Install

npm i angular-iran-national-id

Weekly Downloads

3

Version

1.3.0

License

MIT

Last publish

Collaborators

  • s.samadzadeh