Skip to content

Instantly share code, notes, and snippets.

@Foovanadil
Created February 27, 2017 22:05
Show Gist options
  • Save Foovanadil/296683d90fe6332642f18afefdfd64b3 to your computer and use it in GitHub Desktop.
Save Foovanadil/296683d90fe6332642f18afefdfd64b3 to your computer and use it in GitHub Desktop.
import { Injectable } from '@angular/core';
import { AbstractControl } from '@angular/forms';
@Injectable()
export class CustomValidators {
min(control: AbstractControl, value: number): { [key: string]: boolean } {
return control.value >= value ? null : { 'min': true };
}
max(control: AbstractControl, value: number): { [key: string]: boolean } {
return control.value <= value ? null : { 'max': true };
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment