I'm using Reactive Form on Angular to be able to use both numbers and commas. I made the input type text so that dots and commas appear on the keyboard in the mobile view. I want the entered input to accept only numbers, but the pattern I entered did not help. I can still enter characters after doing this, but I don't want that to happen.
textInput: new FormControl('',
[
Validators.required,
Validators.pattern('[0-9]{7}')
]),
<input autoComplete="off" autoCorrect="off"
type="text"
lang="en"
[formControl]="this.config.textInput"
placeholder="0.0"
minLength={1}
maxLength={79}
spellCheck="false"
(ngModelChange)="amountChanged($event)"
enterkeyhint="next"
step="1"
class="w-100"
>
How can I get the type to be text and only accept numbers?