title: How to use pipes in Component
body: <p>I want to use the datePipe in my component. I followed the instructions <a href="https://stackoverflow.com/questions/35144821/angular-2-4-use-pipes-in-services-and-components">here</a> but I am met with</p>
  <pre class="lang-none prettyprint-override"><code>Error: StaticInjectorError[DatePipe]: 
  StaticInjectorError[DatePipe]: 
  NullInjectorError: No provider for DatePipe!
  
  </code></pre>
  <p>Here is my code:</p>
  <p><strong>Component</strong></p>
  <pre class="lang-js prettyprint-override"><code>import { DatePipe } from '@angular/common';
  
  export class LivePreviewComponent implements OnInit{
      currentDate = new Date();     
    
      constructor(private datePipe:DatePipe) {}
      ngOnInit() {
          this.datePipe.transform(this.currentDate, 'YYYY-MM-DDTHH:mm')
      }
  }
  </code></pre>