🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

@seges/angular-validators

Package Overview
Dependencies
Maintainers
4
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@seges/angular-validators

TypeScript 1.8.10

latest
npmnpm
Version
3.1.2
Version published
Maintainers
4
Created
Source

#Validators for angular directives

##Prerequisites TypeScript 1.8.10

##How to use

Import the module.

Add the module as a dependency to your angular project.

There are five custom validators:

###Maximum and minimum value Validates the given value against a set max/min value. The set max/min value can be dynamic e.g. set through variable reference:

Example with ngMessages:

<form name="myForm">
    <input name="maxval" ng-model="ctrl.value" max-value="{{ctrl.myMaxValue}}"/>
    <div class="validation-messages" ng-messages="myForm.maxval.$error" ng-if="myForm.maxval.$invalid">
        <span ng-message="maxValue">Number is too big</span>
    </div>
</form>

###Integer Validates that the given value is an integer.

Example with ngMessages:

<form name="myForm">
    <input name="int" ng-model="ctrl.value" integer/>
    <div class="validation-messages" ng-messages="myForm.int.$error" ng-if="myForm.int.$invalid">
        <span ng-message="integer">Number is too big</span>
    </div>
</form>

###Minute format Validates that the input is in the format 00:00.

Example with ngMessages:

<form name="myForm">
    <input name="minute" ng-model="ctrl.value" minute-format/>
    <div class="validation-messages" ng-messages="myForm.minute.$error" ng-if="myForm.minute.$invalid">
        <span ng-message="minuteFormat">Number is too big</span>
    </div>
</form>

###24 hour format Validates that the input is in the format 00:00.

Example with ngMessages:

<form name="myForm">
    <input name="hour" ng-model="ctrl.value" 24-hour-format/>
    <div class="validation-messages" ng-messages="myForm.hour.$error" ng-if="myForm.hour.$invalid">
        <span ng-message="24HourFormat">Number is too big</span>
    </div>
</form>

Keywords

seges

FAQs

Package last updated on 25 Apr 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts