Skip to content

minhajuddinkhan/ng-dvalid

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 

Repository files navigation

ng-datespan-validator

alt text Component to validate time span between start dates and end dates.

NPM

npm install ng-dvalid --save

Bower

bower install dvalidate --save

Adding Dependency.

angular.module('app', ['dvalid']);

DOM

<form name="myForm"> 
      <div dvalidate 
        init="your-startdate-ngmodel" 
        end="your-enddate-ngmodel" 
        ng-model="validated-ngmodel"> 
        </div>
</form>

Example

include the package.

    
    <!--npm-->
      <script src="node_modules/ng-dvalid/dvalid.min.js"></script>
    <!--bower-->
      <script src="bower_components/dvalidate/dvalid.min.js"></script>

In your form,

<form name="myForm">

    <input type="date" ng-model="init">
    <input type="date" ng-model="end">

    <div dvalidate init="init" end="end" ng-model="validation"></div>

    <pre>
        {{myForm.$error.startInvalid  | json  }}
        
        {{myForm.$error.startRequired | json  }}
        
        {{myForm.$error.endRequired   | json  }}
    
        {{myForm.$error.endInvalid    | json  }}
            
        {{myForm.$error.spanInvalid   | json  }}
    </pre>
</form>

Note:

timestamps are not validated.

About

start and end date timespan validator.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published