JSPM

angular-cpr-validator

0.1.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 6
  • Score
    100M100P100Q41841F
  • License MIT

Checks whether an input contains a valid Danish CPR number

Package Exports

  • angular-cpr-validator

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (angular-cpr-validator) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Angular CPR validator

AngularJS module that checks whether an input's value is a valid Danish CPR number. Checks that the birthday is valid, as well as the check digit (can be disabled).

Demo

Install

Include Angular and cpr.min.js or cpr.js in your page. You can use bower, or a script-tag:

bower install angular-cpr-validator

or

<script src="http://crisbeto.github.io/angular-cpr-validator/cpr.min.js"></script>

Add angular-cpr-validator to your app's module dependencies:

angular.module('someModule', ['angular-cpr-validator'])

Modulus check

There are some edge cases where checking via a control number is not reliable. If you want to disable this on a particular input, you can specify it via the check-modulus="false" attribute. If you want to disable this check globally, you can change the checkModulus property in the validateCprConfig constant.

Example:

<input ng-model="cpr" validate-cpr>

Development

  • npm install to install development dependencies
  • grunt to build minified demo in build/
  • grunt deploy to build minified demo and push it to gh-pages branch