I'm making a small web application which contains forms need input validation. Currently I'm using built-in validator such as: required, minlength, maxlength, ...
I wonder if there is any way to override them or not. I used the command below for debugging.
<span>{{findCategoryBox.controls.name.errors | json}}</span>
I received this result:
{ "required": true }
I want to override the required validator like this:
<input class="form-control"
placeholder="Category name"
formControlName="name"
required="CATEGORY_REQUIRED"
maxlength="10"
minlength="3"/>
And I want to receive the result like this:
{ "required": "CATEGORY_REQUIRED"}
How can I do that ?
Please help me
Thank you,