Merged PR 720: #1919 Bugfix Reading Age Filter should contain only numbers

#1919 Bugfix Reading Age Filter should contain only numbers
This commit is contained in:
Nino Righi
2021-06-23 11:49:49 +00:00
committed by Lorenz Hilpert
parent 4422a62f92
commit f1065e8592

View File

@@ -34,6 +34,8 @@ export class UiRangeFilterComponent implements OnInit, OnChanges {
return `Der Wert darf nicht kleiner als ${errors[key].min} sein.`;
case 'max':
return `Der Wert darf nicht größer als ${errors[key].max} sein.`;
case 'pattern':
return `Es werden nur ganzzahlige Werte akzeptiert.`;
default:
return errors[key];
}
@@ -47,11 +49,13 @@ export class UiRangeFilterComponent implements OnInit, OnChanges {
start: this.fb.control(this.filter.options[0].value, [
Validators.min(0),
Validators.max(99),
Validators.pattern('^[0-9]+$'), // Only numbers
maxValueRelativeTo((c) => c?.parent?.get('stop')),
]),
stop: this.fb.control(this.filter.options[1].value, [
Validators.min(0),
Validators.max(99),
Validators.pattern('^[0-9]+$'), // Only numbers
minValueRelativeTo((c) => c?.parent?.get('start')),
]),
});