https://github.com/jdforsythe/angular-aba-routing-validation
ABA Routing Number input validation directive for AngularJS 1
https://github.com/jdforsythe/angular-aba-routing-validation
angular angular-directives angular-validation angularjs
Last synced: 3 months ago
JSON representation
ABA Routing Number input validation directive for AngularJS 1
- Host: GitHub
- URL: https://github.com/jdforsythe/angular-aba-routing-validation
- Owner: jdforsythe
- License: mit
- Created: 2016-03-27T07:22:26.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-02-09T17:27:34.000Z (over 8 years ago)
- Last Synced: 2025-08-20T18:40:37.882Z (3 months ago)
- Topics: angular, angular-directives, angular-validation, angularjs
- Language: JavaScript
- Size: 13.7 KB
- Stars: 2
- Watchers: 1
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
angular-aba-routing-validation
==============================
[](https://travis-ci.org/jdforsythe/angular-aba-routing-validation)
An Angular directive for validating a routing number input field.
## Installation
```bash
$ bower install angular-aba-routing-validation
```
## Setup
Include `angular-aba-routing-validation'` in your module's dependencies:
```js
angular.module('myApp', ['angular-aba-routing-validation']);
```
## Usage
Simply add the `routing-number` attribute to your `` field.
The directive attaches four properties to the `$error` property of your form field, so they can be used like any of the built-in validation directives (like `ng-minlength`, `ng-pattern`, etc.).
1. `formName.fieldName.$error.abaRouting` - the provided routing number fails validation (invalid length, invalid starting number, or fails algorithm check). Note that this does not set an error if the model is empty (`null` or `""`) so that you can make the input conditionally optional. You'll need to include `required` or `ng-required` to error when the model is empty.
2. `formName.fieldName.$error.abaRoutingInternal` - the provided routing number indicates a bank's internal routing number (begins with a 5) and is not a valid account routing number
3. `formName.fieldName.$error.abaRoutingMinLength` - the provided routing number is too short (less than 9 digits)
4. `formName.fieldName.$error.abaRoutingMaxLength` - the provided routing number is too long (more than 9 digits) - this probably shouldn't happen because `ng-maxlength` is automatically applied, which should restrict the user from being able to type in more than 9 characters, but...
This directive also includes `x-autocompletetype="routing-transit-number"` for good measure.
### Example with `ng-messages`
```html
Routing number is required
Routing number must be exactly 9 digits
You have provided an internal bank routing number
Routing number is invalid
```
### Without `ng-messages`
```html
Routing number is required
Routing number must be exactly 9 digits
You have provided an internal bank routing number
Routing number is invalid
```
### Optional
```html
Credit
Check
Routing number is required when choosing check
Routing number is invalid
```
## Tests
A round of tests is included. To run the tests, execute:
```
karma start karma.conf.js
```
## Contributions
Contributions are always welcome. Please submit issues and pull requests.
## License
[MIT](LICENSE)