Angular2 Use enum in pipe
<p>I have this filter Pipe:</p>

<pre><code>import { Pipe, PipeTransform } from '@angular/core';
import { TaskStatus } from './task-status';

@Pipe({name: 'WithStatus'})
export class TaskStatusFilter implements PipeTransform{
    transform(items: any[], args: any[]): any {
        return items.filter(item =&gt; item.status == args[0]);
    }
}
</code></pre>

<p>TaskStatus is an enum:</p>

<pre><code>export enum TaskStatus{
    New, Dev, Test, Deploy
}
</code></pre>

<p>Now I want to use the pipe in a component by passing an enum value.</p>

<pre><code>import { Component, OnInit } from '@angular/core';
import { Task } from '../task/task';
import { TaskStatus } from '../task/task-status';

@Component({
  selector: 'app-board',
  templateUrl: './board.component.html',
  styleUrls: ['./board.component.css']
})
export class BoardComponent implements OnInit {
  tasks: Array&lt;Task&gt;;
  public TaskStatus = TaskStatus;
  constructor() {
    this.tasks = [
      new Task(1,'tasl1', 'task1 description', TaskStatus.New),
      new Task(2,'tasl2', 'task2 description', TaskStatus.New),
      new Task(3,'tasl3', 'task3 description', TaskStatus.New),
      new Task(4,'tasl4', 'task4 description', TaskStatus.Dev),
      new Task(5,'tasl2', 'task2 description', TaskStatus.Dev),
      new Task(6,'tasl6', 'task6 description', TaskStatus.Test),
      new Task(7,'tasl7', 'task7 description', TaskStatus.Deploy)
    ];
  }
  ngOnInit() { }
}
</code></pre>

<p>board.component.html:</p>

<pre><code>&lt;div class="grid grid-pad"&gt;
  &lt;div class="col-1-4"&gt;
    &lt;div class="content"&gt;
      &lt;h2&gt;New&lt;/h2&gt;
      &lt;app-task-card *ngFor="let task of tasks | WithStatus: TaskStatus.New" [task]="task"&gt;&lt;/app-task-card&gt; &lt;!-- This does not work - the filter is false for every element  --&gt;
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="col-1-4"&gt;
    &lt;div class="content"&gt;
      &lt;h2&gt;Development&lt;/h2&gt;
      &lt;app-task-card *ngFor="let task of tasks | WithStatus: '1'" [task]="task"&gt;&lt;/app-task-card&gt; &lt;!--passing the value of the enum works--&gt;
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="col-1-4"&gt;
    &lt;div class="content"&gt;
      &lt;h2&gt;Test&lt;/h2&gt;
      &lt;app-task-card *ngFor="let task of tasks | WithStatus: '2'" [task]="task"&gt;&lt;/app-task-card&gt;
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="col-1-4"&gt;
    &lt;div class="content"&gt;
      &lt;h2&gt;Deploy&lt;/h2&gt;
      &lt;app-task-card *ngFor="let task of tasks | WithStatus: '3'" [task]="task"&gt;&lt;/app-task-card&gt;
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;
</code></pre>

<p>If I pass a string that corresponds to the enum value like '0', '1', etc., it works, but if I pass TaskStatus.New - no values are displayed. </p>

<p>Is there a way to use an enum as a Pipe argument?  </p>