title: TypeScript Equivalent
body: <p>Using the below code in Angular to cast the number to 2 decimal places using <code>DecimalPipe</code>.</p>
  
  <pre><code>constructor(private decimalPipe: DecimalPipe) {}
  
  this.decimalPipe.transform('0','.2-2') //output 0.00
  </code></pre>
  
  <p>Any ideas of the<code>TypeScript</code> equivalent?</p>
  
  <p><code>toPrecision(2)</code> doesn't works the same</p>
  
  <p>e.g.</p>
  
  <pre><code>var num = 2;
  
  2.toPrecision(2)
  </code></pre>
  
  <p>Expected: <code>2.00</code>
  Actual: <code>2.0</code></p>