diff --git a/client/src/app/infrastructure/utils/validators/is-number-range.ts b/client/src/app/infrastructure/utils/validators/is-number-range.ts index 0c8b3795d7..5606d2b24a 100644 --- a/client/src/app/infrastructure/utils/validators/is-number-range.ts +++ b/client/src/app/infrastructure/utils/validators/is-number-range.ts @@ -1,6 +1,6 @@ import { AbstractControl, ValidatorFn } from '@angular/forms'; -export function isNumberRange(minCtrlName: string, maxCtrlName: string, errorName: string): ValidatorFn { +export function isNumberRange(minCtrlName: string, maxCtrlName: string, errorName: string = `rangeError`): ValidatorFn { return (formControl: AbstractControl): { [key: string]: any } | null => { const min = formControl.get(minCtrlName)!.value; const max = formControl.get(maxCtrlName)!.value; diff --git a/client/src/app/infrastructure/utils/validators/validators.spec.ts b/client/src/app/infrastructure/utils/validators/validators.spec.ts index 03ca2a6a6e..fcd16f8fc9 100644 --- a/client/src/app/infrastructure/utils/validators/validators.spec.ts +++ b/client/src/app/infrastructure/utils/validators/validators.spec.ts @@ -5,7 +5,7 @@ import { isUniqueAmong } from './is-unique-among'; describe(`utils: validators`, () => { describe(`isNumberRange function`, () => { - const validatorFn = isNumberRange(`min`, `max`, `errorName`); + const validatorFn = isNumberRange(`min`, `max`); it(`test with correct values`, () => { const group = new UntypedFormGroup( { diff --git a/client/src/app/site/pages/meetings/modules/poll/components/base-poll-form/base-poll-form.component.ts b/client/src/app/site/pages/meetings/modules/poll/components/base-poll-form/base-poll-form.component.ts index 982fdd2e06..b55940abad 100644 --- a/client/src/app/site/pages/meetings/modules/poll/components/base-poll-form/base-poll-form.component.ts +++ b/client/src/app/site/pages/meetings/modules/poll/components/base-poll-form/base-poll-form.component.ts @@ -473,7 +473,7 @@ export abstract class BasePollFormComponent extends BaseComponent implements OnI }, { validators: [ - isNumberRange(`min_votes_amount`, `max_votes_amount`, `rangeError`), + isNumberRange(`min_votes_amount`, `max_votes_amount`), this.enoughPollOptionsAvailable(`min_votes_amount`, `max_votes_per_option`), isNumberRange(`max_votes_per_option`, `max_votes_amount`, `rangeErrorMaxPerOption`) ]