title: Angular 2: how to use a custom pipe in component logic code, not in template
body: <p>I used to create custom filters with ionic 1 (angularjs) and then use them either in the template <code>{{data | customfilter }}</code> or in the controller <code>str = $filter('customfilter')(data);</code>.</p>
  
  <p>Now I just created a pipe with angular 2, but how to use it in the typescript code ?</p>
  
  <p>Thanks</p>
  
  <p>src/pipes/nospace.ts:</p>
  
  <pre><code>import {Pipe} from '@angular/core';
  
  @Pipe({
    name: 'nospace'
  })
  export class Nospace {
    transform(value, args) {
      return (!value) ? '' : value.replace(/ /g, '');
    }
  }
  </code></pre>
  
  <p>src/pages/page.ts:</p>
  
  <pre><code>import {Component} from '@angular/core';
  import {Nospace} from '../../pipes/nospace';
  
  @Component({
    templateUrl: 'build/pages/home/home.html',
    pipes: [Nospace]
  })
  export class HomePage {
  
    myString: any;
  
    constructor() {
      this.myString = "Pipes are super cool";
      //I want to use the pipe here !
    }
  }
  </code></pre>