I really don't understand what's the problem is with this code
<input #quantity type="number" matInput formControlName="quantity" (input)="onQuantity($event, i)" placeholder="Quantity"/>
onQuantity(event: InputEvent, i: number) {
if (!this.totals[i]) {
this.totals[i] = { price: '0', quantity: 1 };
}
let value = (event.target as HTMLInputElement).value;
value = value ? value : '0';
this.totals[i].quantity = parseInt(value, 10);
}
The compiler get an error Argument of type 'Event' is not assignable to parameter of type 'InputEvent'. and if I use
onQuantity(event: Event, i: number)
I get Type 'Event' is missing the following properties from type 'InputEvent': data, inputType, isComposing, detail, and 2 more.
so I don't known what way to turn :( Can anyone help me, please?
UPDATE
I have worked it out with
(input)="onQuantity(quantity.value, i)"