Mason belyeu
Mason belyeu

Reputation: 65

Angular 2 -Can not multiply two interpolated values?

I am attempting to multiply two interpolated values, but I am not having much success. When I attempt to use {{}}*{{}} the values are displayed and no multiplication occurs. I can see both values, but there is no calculation.

displays 10.00*.20 instead of 20% of 10 which would be 2.00

  <tr>
          <td class="table-borderless"  colSpan="4" class="text-right"><b>Total</b></td>
          <td>${{ Items | cartTotal  | number: '.2'}}{{estimate.discount}}</td>
      </tr>

Upvotes: 2

Views: 953

Answers (1)

Sulthan
Sulthan

Reputation: 130102

Instead of multiplying the interpolated strings, multiply the expressions and then interpolate:

{{ (Items | cartTotal | number: '.2') * estimate.discount}}

Upvotes: 4

Related Questions