mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
[ADF-2925] Required and invalid validators added (#3277)
* test added * tests clean * test added * tslint clean * test name changed * update tests
This commit is contained in:
committed by
Maurizio Vitale
parent
db7d0b7c08
commit
fd924c439a
@@ -44,6 +44,8 @@ export class SearchNumberRangeComponent implements SearchWidget, OnInit {
|
||||
field: string;
|
||||
format = '[{FROM} TO {TO}]';
|
||||
|
||||
validators: Validators;
|
||||
|
||||
ngOnInit(): void {
|
||||
|
||||
if (this.settings) {
|
||||
@@ -51,13 +53,13 @@ export class SearchNumberRangeComponent implements SearchWidget, OnInit {
|
||||
this.format = this.settings.format || '[{FROM} TO {TO}]';
|
||||
}
|
||||
|
||||
const validators = Validators.compose([
|
||||
this.validators = Validators.compose([
|
||||
Validators.required,
|
||||
Validators.pattern(/^-?(0|[1-9]\d*)?$/)
|
||||
]);
|
||||
|
||||
this.from = new FormControl('', validators);
|
||||
this.to = new FormControl('', validators);
|
||||
this.from = new FormControl('', this.validators);
|
||||
this.to = new FormControl('', this.validators);
|
||||
|
||||
this.form = new FormGroup({
|
||||
from: this.from,
|
||||
|
Reference in New Issue
Block a user