fix(forms): introduce checkbox required validator

Closes #11459
Closes #13364
This commit is contained in:
Dzmitry Shylovich
2016-12-10 13:44:04 +03:00
committed by Victor Berchet
parent 7b0a86718c
commit 2bf1bbc071
8 changed files with 172 additions and 16 deletions
+7
View File
@@ -64,6 +64,13 @@ export class Validators {
return isEmptyInputValue(control.value) ? {'required': true} : null;
}
/**
* Validator that requires control value to be true.
*/
static requiredTrue(control: AbstractControl): {[key: string]: boolean} {
return control.value === true ? null : {'required': true};
}
/**
* Validator that requires controls to have a value of a minimum length.
*/