I'm using Angular 8 for my client application. I want an error message to be displayed under the input box for the user when she inserts a wrong input. I'm using this inside my HTML:
<!-- Score input -->
<div class="form-group">
<label for="score">Score</label>
<input type="number" class="form-control"
placeholder="0.0 ÷ 10.0"
min="0.0" max="10.0" step="0.1" name="score"
id="score"
[(ngModel)]="model.score"
#score="ngModel">
<div [hidden]="score.valid" class="alert alert-danger">
Insert a value between 0.0 and 10.0
</div>
</div>
I would expect it to be displayed if the user was to input "asdf" for example instead of a number like "6.7". But it never appears. I tried removing [hidden]="score.valid"
and it gets correctly displayed. Why is Angular considering "asdf" a valid input even if I set all those attributes: type="number" min="0.0" max="10.0" step="0.1"
?