Reputation: 357
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.
Upvotes: 1
Views: 83
Reputation: 691685
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.
Upvotes: 2