简体   繁体   中英

change variable when inputs changed in Angular

When numbers are entered in the price(Fiyat) fields in the picture, I want the place that says 0 TL to change. The place that says 0 TL should be the sum of the numbers step by step. How can i do that?

<td><input (keypress)="keyPressNumbersWithDecimal($event)" type="text" id="price_{{i}}" name="price"/></td>

<td colspan="3" style="color: #f87575; text-align: right; ">{{totalPrice}} TL</td>

Note: number of inputs is dynamic

在此处输入图像描述

Instead of

<input (keypress)="keyPressNumbersWithDecimal($event)" type="text" id="price_{{i}}" name="price"/>

Try

<input [(ngModel)]="totalPrice" type="text" id="price_{{i}}" name="price"/>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM