ABN validation directive for AngularJS. Uses the Australian Taxation Office (ATO) ABN verification formula.
View the demo at jmontagu.github.io/ng-AustralianBusinessNumber/
- Install Karma, Grunt and Bower
$ npm install -g karma grunt-cli bower
- Install development dependencies
$ npm install
- Install components
$ bower install
This project uses Grunt to check for JavaScript syntax errors and execute all unit tests. To run Grunt, simply execute:
$ grunt
- Add src/australianBusinessNumber.js to your solution
- Add the australianBusinessNumber module as a dependency to your application module:
var myAppModule = angular.module('MyApp', ['australianBusinessNumber']);
Apply this directive to your form elements:
<input type="text" ng-model="client.abn" abn />
To make the element mandatory:
<input type="text" ng-model="client.abn" abn required />
To display a validation error:
<form name="form">
<input name="abnInput" ng-model="client.abn" abn />
<span ng-show="form.$error.abnInput">Invalid ABN</span>
</form>
This code is released under the MIT license.