I would like to know how to set a min and max number in angular2 when we try to limit an input text it's very simple we have to put any ideas about limiting the number for exemple 3 numbers
it work perfect on type text but with number I think we have to do a directive
Angular provide some Validators like required,maxLength.. but you can create your own Validator like this :
function validateNumber(c: FormControl) {
return c.value > 0 && c.value < 100 ? null : {valid: false}
};
new FormControl('', validateNumber)If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With