Reputation: 487
<pre> {{((itemInfoForm.controls['quantity'].value) + (selected_item.quantity))}}</pre>
output : 10+10=1010
expected result: 10+10=20
Upvotes: 0
Views: 509
Reputation: 86800
Simply create one method and pass parameter along with and get return as number like this
<pre>
{{changeType(itemInfoForm.controls['quantity'].value) + changeType(selected_item.quantity)}}
</pre>
......//and in your controller side write function like this
changeType(val){
return +(val);
}
Upvotes: 1
Reputation: 2384
Try the below code, convert them to numbers using parseInt
{{parseInt(itemInfoForm.controls['quantity'].value) + parseInt(selected_item.quantity)}}
Upvotes: 0