0

I want to calculate two field sum my code like

                            {{(((greyDemandPrice/orderQuanity)*orderedProduct.ExchangeRateBDT)+orderedProduct.EffectiveWeavingCharge)}}

result showing like 101.4232635 24.32 How can i solve this?

1 Answers1

0

Because javascript are treating them as string not integer, use parseInt().

{{(((greyDemandPrice/orderQuanity)*orderedProduct.ExchangeRateBDT)+parseFloat(orderedProduct.EffectiveWeavingCharge))}}

flakerimi
  • 1,867
  • 2
  • 24
  • 43
  • When i using parseInt() or parseFloat() result become white. Nothing showing – Sanjoy Debnath Aug 26 '20 at 11:49
  • try to output one by one with parseFloat() and see which one is not giving output – flakerimi Aug 26 '20 at 12:04
  • https://stackoverflow.com/questions/14667713/how-to-convert-a-string-to-number-in-typescript – flakerimi Aug 26 '20 at 12:16
  • also convert to numbers before sending to template, https://www.angularjswiki.com/angular/how-to-convert-a-string-to-number-in-angular-or-typescript/ – flakerimi Aug 26 '20 at 12:23
  • please try this way {{((((parseFloat(greyDemandPrice)*parseFloat(orderedProduct.ExchangeRateBDT))/parseFloat(orderQuanity)))+parseFloat(orderedProduct.EffectiveWeavingCharge))}} If this wouldn't give you result . better put a debug point on console and see them. – Chaminda Jayanath Udawatte Aug 27 '20 at 20:17
  • I am able to solve the problem. I am trying to do it on view. In this time I am doing in controller. Now it's working fine. Thanks a lot how try to help me. – Sanjoy Debnath Sep 01 '20 at 14:43
  • thats why I said "also convert to numbers before sending to template" – flakerimi Sep 01 '20 at 20:09