I have form with input field with default value. I want to add validation for that field to have exactly 5 characters.
<td>
<input type="text" maxlength="5" ngModel
#number="ngModel" name="number" value="{{data.number}}" class="form-control">
</td>
The problem is that I cannot get that default value in order to validate as the value of input shows mi empty string "". If I change that value the proper value is visible. Is there a way to use validator in this case ?
SOLUTION:
<td>
<input type="text" maxlength="5" [(ngModel)]="data.number"
#number name="number" class="form-control">
</td>
minlength = 5