0.6.5 • Published 4 years ago

ng-input-filter v0.6.5

Weekly downloads
4
License
MIT
Repository
github
Last release
4 years ago

ngInputFilter

Input Filter library (Number & Alphabet For Persian & English Language) For AngularJS.

Number Filter :

Only Allow Numeric Values.

Alphabet Filter :

Any Values Are Allowed But Returns Valid/InValid Status And Synced With Ng-Message.

Getting started

npm

To install ngInputFilterNumber use npm

npm install ng-input-filter --save

The first way

Inject the ngInputFilter to your angular-application module.

import {ngInputFilter} from  "ng-input-filter";
var  app = angular.module('myApp', ['ngInputFilter']);

The second way

inject ngInputFilterNumber or ngInputFilterAlpha to your angular-application As a directive.

var  app = angular.module('myApp', []);

import {ngInputFilterNumber} from  "ng-input-filter";
ngModule.directive("ngInputFilterNumber", ngInputFilterNumber);

import {ngInputFilterAlpha} from  "ng-input-filter";
ngModule.directive("ngInputFilterAlpha", ngInputFilterAlpha);

Docs

Number directive

  1. Integer (positive only):
    <input type="text" ng-model="self.myModel"
    ng-input-filter-number="uint">
 2. Integer (positive and <= 500):
 ```html
<input type="text" ng-model="self.myModel"
ng-input-filter-number="longInt" long-int="80">
  1. Integer (both positive and negative):
    <input type="text" ng-model="self.myModel"
    ng-input-filter-number="int">
 4. Floating point (use . or , as decimal separator):
 ```html
<input type="text" ng-model="self.myModel"
ng-input-filter-number="float">

Alphabet directive

  1. English Alphabet:
    <input type="text" ng-model="self.myModel"
    ng-input-filter-alphabet="englishAlphabet">
 2. English:
 ```html
<input type="text" ng-model="self.myModel"
ng-input-filter-alphabet="english">
  1. Persian Alphabet:
    <input type="text" ng-model="self.myModel"
    ng-input-filter-alphabet="persianAlphabet">
 4. Persian:
 ```html
<input type="text" ng-model="self.myModel"
ng-input-filter-alphabet="persian">
  1. Persian With English Number:
    <input type="text" ng-model="self.myModel"
    ng-input-filter-alphabet="persianWithEnglishNumber">
 6. Persian And English Alphabet:
 ```html
<input type="text" ng-model="self.myModel"
ng-input-filter-alphabet="persianAndEnglishAlphabet">

When you Want To Handle Error Text Messages With Ng-Messages

<div ng-messages="formName.inputName.$error">
<div ng-message="inputFilterAlphabet">
	Your Text For Invalid
</div>
</div>

Feedback, Feature requests, and Bugs

All are welcome on the issue tracker.