title: How can I communicate between Pipe and Component in Angular 2
body: <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code> &lt;tr *ngFor="let logDetails of logDetails | search : term" &gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>I have a Pipe in which I want to use a variable. Same variable has been defined in my Component. How can I pass this value from Component to Pipe?</p>
  
  <pre class="lang-ts prettyprint-override"><code>//Pipe Structure
  
  transform(value, [term], newVal) {
    if (value == undefined &amp;&amp; newVal == undefined) {
      return undefined;
    } else {
      return value.filter((item) =&gt; item.LogString.startsWith(term));
    }
  }
  
  //Component Structure
  
  newVal(a) {
    this.newChildData = a;
    console.log(this.newChildData);
  }
  </code></pre>
  
  <p>I want to pass <code>newChildData</code> of Component into <code>newVal</code> of Pipe.</p>
  
  <p>// HTML Template</p>
  
  <p></p>