I set the input value by calculating the other two ngModels, and this seems to work fine. But if I check my ngModel, that will not change at all. Let me show you:
<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>
So here {{product.totalPrice}} shows the initial value, which is excellent. If I manually change this input, the changes will be reflected in the expression, which is fine too. But this input will be read-only, and it will be set by changing the other two inputs. When I change them, I see that the input value is updated just fine, but not the expression in the label. What is wrong there?
This is really strange because the value in the input GETS is UPDATED, but not the expression {{product.totalPrice}}, I think the value is updated because there are other fields, but these value changes never get into ngModel
By the way, I'm using Ionic 2
source
share