title: Angular2 Using Pipes in Component.js
body: <p>I'm learning Angular2 and I want to format a number adding thousand comma separator. As far as I have read this can be done using Pipes, the thing is that I want to format the number programmatically in the js file not in html (doing like var | number).</p>
  
  <p>First of all I've realized there is no NumberPipe standalone pipe that I can work with (correct me if I'm wrong) the most similar one is CurrencyPipe in @angular2/common. So I have something like this:</p>
  
  <pre><code>import { Component } from '@angular/core';
  import { CurrencyPipe } from '@angular/common';
  
  @Component({
    templateUrl: 'test.component.html',
    styleUrls: ['./test.component.scss']
  })
  export class TestComponent {
      public myNumber = 1000;
  
      constructor(private currencyPipe: CurrencyPipe) {    
          var formatted = this.currencyPipe().transform(this.myNumber, 'MXN', true); // Is this correct?
      }
  
  }
  </code></pre>
  
  <p>But it throws me the following error:
      <strong>Unhandled Promise rejection: No provider for CurrencyPipe! ; Zone: angular ;...</strong></p>
  
  <p>What am I doing wrong? </p>
  
  <p>Thanks in advance.</p>
  
  <p>Regards</p>