title: Angular 2 pipe with variable parameter
body: <p>I'm in the course of learning Angular2/Ionic2 so please excuse my ignorance. I got to learning Pipes and everything seemed easy until I stumbled on this problem. Let me demonstrate the problem using a perfect example with temperatures.</p>
  
  <p>Say that I have pipe which return Celisus or Fahrenheit temperature value, depending on the setting saved on localStorage (Celsius is default input value).</p>
  
  <p>So I created a Pipe which do this:</p>
  
  <pre class="lang-ts prettyprint-override"><code>export class TemperatureConverterPipe implements PipeTransform {
  
    // Selected temperature unit
    private unit: string;
  
    constructor(private settings: Settings){
      // Get immediately the temperature unit from localStorage
      // And subscribe to changes
      this.settings.radio().subscribe(data =&gt; {
        this.unit = data.temp_unit
      });
    }
  
    // Return temperature
    transform(value: number): number {
      switch(this.unit){
        case "c":
          return value;
          break;
        case "f":
          return celsiusToFahrenheit(value);
          break;
        default:
         return value;
      }
    }
  
    // Convert celsius temp to fahrenheit
    celsiusToFahrenheit(value: number){
       return value * 9/5 + 32;
    }
  
  }
  </code></pre>
  
  <p>Problems I'm stuck at:</p>
  
  <ol>
  <li>How this pipe can watch for parameter change (Temperature unit) and return the new values (e.q. C to F)? Because currently it only watches for Input (Temperature value) changes.</li>
  <li>Is this a correct way to solve this?</li>
  </ol>
  
  <p>Thank you very much!</p>