1

How can I get the min length value in the form?

<div *ngIf="dataForm.get('description').hasError('minlength') && dataForm.get('description').touched">
   The product description minimum length is {{ dataForm.controls.description.minlength }}.
</div>

I tried dataForm.controls.description.minlength and it prints nothing.

1 Answer 1

2

dataForm.get('description').getError('minlength').requiredLength

Shameless plug: I would strongly advise avoiding to hardcode and repeat all these checks in your forms and use ngx-valdemort instead.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.