I am still learning basic of angular 6 and typescripts and I am not sure how to make this work. I have one field, if user put some number value there (for example "100"), values in other inputs should change. I am pretty sure that I should use debounceTime and 'rxjs' like in this tutorial: https://angular.io/tutorial/toh-pt6, but I can't figure it out how to make this work.
If user put '100' in "how much" field, Tomek's and Magda's field values should change to '50' (100 / 2)
expense-shared.component.html
<div class="form-group">
<label for="name">How much?</label>
<input type="text" class="form-control" id="amount" required
[(ngModel)]="expense.amount" (keyup)="changeListValues(expense.amount)"
name="amount" #amount="ngModel" placeholder="Amount in EUR">
<div [hidden]="amount.valid || amount.pristine" class="alert alert-danger">
Amount is required
</div>
</div>
expense-shared.component.ts
@Input() amountList: Equally[];
changeListValues(expenseTotalAmount: number) {
const checkedAmount = this.amountList.filter(x => x.checked).length;
this.amountList.filter(x => x.checked).forEach(element => {
element.quantity = this.expense.amount / checkedAmount;
});
}
