In my code, I am successfully setting the value of an input by calculating two other ngModels. However, despite the input value updating, the ngModel itself remains unchanged. Take a look at the snippet below:
<ion-item>
<ion-label>Total price: {{product.totalPrice}}</ion-label>
<ion-input
type="number"
[value]="product.quantity * product.price"
[(ngModel)]="product.totalPrice"
[ngModelOptions]="{ standalone: true }"></ion-input>
</ion-item>
Initially, {{product.totalPrice}}
displays the correct value. Manually changing the input updates the expression correctly as well. However, when the input is set programmatically based on two other inputs, the label's expression does not update. What could be causing this issue?
It's puzzling because although the input value updates visibly, the expression {{product.totalPrice}}
does not reflect these changes. It seems like the input value updates due to changes in other fields, but these updates do not affect the ngModel bindings.
For reference, I am working with Ionic 2