Skip to content
A tiny angular custom validation enabler using ngModel and ngMessage
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
dist
src
LICENSE
README.md
bower.json

README.md

angular-constraints

A tiny angular custom validation enabler using ngModel and ngMessage

Usage

###Template:

    <form name="form">
      <label>Data</label>
      <input type="text" name="data" ng-model="model.data" constraints="email, assigned">
      <div ng-messages="form.data.$error">
        <div ng-message="email">Invalid email address.</div>
        <div ng-message="assigned">Provided email address is not available.</div>
      </div>
    </form>

###JS:

    $scope.email = function(value) {
      // validate
      return true;
    };
    
    $scope.assigned = function(value) {
      // validate
      return true;
    };    
    
    angular.module('myModule', ['ngMessages', 'angular-constraints']);

constraints directive takes custom functions separated by white space characters, comma, colon, semi-colon or pipe character.

License

This plugin is licensed under the MIT license.

Copyright (c) 2015 Prince John Wesley

You can’t perform that action at this time.