From Angular docs:
Formats a number as text.
You cannot use DecimalPipe on <input>
tag. Like the following:
<p> {{product.itemamount | number: '1.2-2'}} ></p>
To make the formatting of an input you have to write a custom pipe/directive/method, etc..
UPDATE:
Here is some idea of a custom validation directive:
HTML
<input decimal [(ngModel)]="value" name="value" >
Directive:
HostListener('input', ['$event'])
onInput($event){
let formattedValue: string;
let arrayValue = this.el.nativeElement.value.split('.');
let patternValidation = arrayValue[0].match(/[0-9]{3}/);
if (patternValidation !== null && arrayValue[0].length > 3) {
let thousands = Array.from(Array.from(arrayValue[0]).reverse().join('').match(/[0-9]{3}/).join()).reverse().join('');
let replacement = arrayValue[0].replace(thousands.replace(/\D/g, ''), '');
formattedValue = (replacement.length > 0 ? replacement + "," : "") + thousands;
} else {
formattedValue = arrayValue[0];
}
if (arrayValue.length > 1) {
formattedValue = formattedValue + "." + arrayValue[1].substring(0, 2);
}
}
Stackblitz demo