npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

angular-aba-routing-validation

v1.0.3

Published

Angular directive for validating ABA routing number

Downloads

19

Readme

angular-aba-routing-validation

Build Status

An Angular directive for validating a routing number input field.

Installation

$ bower install angular-aba-routing-validation

Setup

Include angular-aba-routing-validation' in your module's dependencies:

angular.module('myApp', ['angular-aba-routing-validation']);

Usage

Simply add the routing-number attribute to your <input> 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

<form name="checkInputForm">
  <input type="text" ng-model="vm.routingNumber" name="routingInput" ng-required="true" routing-number>
  <div ng-messages="checkInputForm.routingInput.$dirty && checkInputForm.routingInput.$invalid">
		<div ng-message="required">Routing number is required</div>
		<div ng-message="abaRoutingMinLength">Routing number must be exactly 9 digits</div>
    <div ng-message="abaRoutingInternal">You have provided an internal bank routing number</div>
    <div ng-message="abaRouting">Routing number is invalid</div>
  </div>
</form>

Without ng-messages

<form name="checkInputForm">
  <input type="text" ng-model="vm.routingNumber" name="routingInput" ng-required="true" routing-number>
  <div ng-if="checkInputForm.routingInput.$dirty && checkInputForm.routingInput.$invalid">
		<div ng-if="checkInputForm.routingInput.$error.required">Routing number is required</div>
		<div ng-if="checkInputForm.routingInput.$error.abaRoutingMinLength">Routing number must be exactly 9 digits</div>
    <div ng-if="checkInputForm.routingInput.$error.abaRoutingInternal">You have provided an internal bank routing number</div>
    <div ng-if="checkInputForm.routingInput.$error.abaRouting">Routing number is invalid</div>
  </div>
</form>

Optional

<form name="paymentInputForm">
  <div>
    <input type="radio" ng-model="vm.paymentType" name="paymentType" ng-required="true" value="credit">Credit<br>
    <input type="radio" ng-model="vm.paymentType" name="paymentType" ng-required="true" value="check">Check
  </div>
  <div>
    <input type="text" ng-model="vm.routingNumber" name="routingInput" ng-required="vm.paymentType == 'check'" routing-number>
    <div ng-if="checkInputForm.routingInput.$dirty && checkInputForm.routingInput.$invalid">
      <div ng-if="checkInputForm.routingInput.$error.required">Routing number is required when choosing check</div>
      <div ng-if="checkInputForm.routingInput.$error.abaRouting">Routing number is invalid</div>
    </div>
  </div>
</form>

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