title: Round decimal in Angular 4 Component
body: <p>I get an error trying to round a decimal to two digits using DecimalPipe inside of a controller.<br>
  When I try </p>
  
  <pre><code>   import { DecimalPipe } from '@angular/common';
      .....
  
      var networth = (this.decimalPipe.transform(p.usdPrice * portfolioRecord.amount, '1.2-2'));
      //currentWorth field is a "number" type.
      portfolioRecord.currentWorth = networth;
  </code></pre>
  
  <p>the "networth" variable is a "string | null" type and cannot be set to a number.  What is the best way to round a decimal inside the controller so I can set it to a number variable?  </p>
  
  <p>Update:   using answer from comments:</p>
  
  <pre><code>var networth = p.usdPrice * portfolioRecord.amount;
  portfolioRecord.currentWorth = +networth.toFixed(2); 
  </code></pre>