title: Select Option Filter in Angular 4 with pipe
body: <p>I am trying to create a pipe with the selectbox dropdown for filtering the list in json data. I have created a pipe with selectbox pipe. I am not able to get my filter work in pipe. Please help. Here is my code - </p>
  
  <p>Select Box - </p>
  
  <pre><code>&lt;select class="form-control" [(ngModel)]="sel" name="sel"&gt;
     &lt;option selected disabled&gt;Select&lt;/option&gt;
      &lt;option *ngFor="let positionOpt of positionSelect" [value] = "sel"&gt;{{positionOpt.name}}&lt;/option&gt;
  &lt;/select&gt;
  </code></pre>
  
  <p>Data For SelectBox Options Field - </p>
  
  <pre><code>positionSelect:any[] = [
  {
    name: "Social Media Manager",
    position: "Social Media Manager"
  },
  {
    name: "Product Manager",
    position: "Product Manager"
  }
  ]
  </code></pre>
  
  <p>Pipe for selectbox - </p>
  
  <pre><code>import { Pipe, PipeTransform } from '@angular/core';
  import { JobsService } from '../services/jobs.service';
  
  @Pipe({
    name: 'selectbox'
  })
  export class SelectboxPipe implements PipeTransform {
  
    transform(opt: any, sel?: any): any {
      return (opt || opt === '0')
          ? opt.filter(sal =&gt; { return sal.position == sel})
          : opt;
  }
  
  }
  </code></pre>
  
  <p>Job List Data - </p>
  
  <pre><code>&lt;ul class="jobs-list"&gt;
      &lt;li *ngFor="let joblists of jobList | selectbox: sel"&gt;
           {{joblists.position}}
      &lt;/li&gt;
  &lt;/ul&gt;
  </code></pre>
  
  <p>This jobList data in Json is coming from a service. Should I use *ngFor in select option field from jobList or it is fine coming from different json data. Please help with selectbox filter. </p>