I succeeded by using a form control.
This is my html code :
<md-input-container>
<input type="number" min="0" max="100" required mdInput placeholder="Charge" [(ngModel)]="rateInput" name="rateInput" [formControl]="rateControl">
<md-error>Please enter a value between 0 and 100</md-error>
</md-input-container>
And in my Typescript code, I have :
this.rateControl = new FormControl("", [Validators.max(100), Validators.min(0)])
So, if we enter a value higher than 100 or smaller than 0, the material design input become red and the field is not validate. So after, if the value is not good, I don't save when I click on the save button.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…