When using a lu-number-input with min and/or max input, they are forwarded to the inner input type="number" which triggers Angular's MinValidator or the corresponding for max.
This means that if a value is already present when adding the field, it won't be checked by the newly added validators, resulting in form being marked as valid despite being invalid.
Further investigation is needed but a quick and dirty fix on the consumer end is to add a new patchValue call after initializing the form.
When using a
lu-number-input
withmin
and/ormax
input, they are forwarded to the innerinput type="number"
which triggers Angular's MinValidator or the corresponding for max.This produces a changes call (https://github.com/angular/angular/blob/1bdc3f1aaef5a7e8bee25447aa8619872cf0eb96/packages/forms/src/directives/validators.ts#L158) which doesn't trigger a new validation cycle because it happens before
registerOnValidatorChange
which is declared few lines below.This means that if a value is already present when adding the field, it won't be checked by the newly added validators, resulting in form being marked as valid despite being invalid.
Further investigation is needed but a quick and dirty fix on the consumer end is to add a new
patchValue
call after initializing the form.