I'm following the turorial of John Lindquist about Angular 2 on egghead.com and after doing exactly the same thing as him I don't have the same result.
It's about the course 17.
I have a custom filter which works perfectly :
started-pipe.ts
import {Pipe} from '@angular/core';
@Pipe({
name: "started"
})
export class StartedPipe{
transform(value, [status]){
return value.filter((item)=> item.status === "started");
}
}
todo-list.ts
import {Component, Input} from '@angular/core';
import {TodoService} from "./todo-service";
import {TodoItemRenderer} from "./todo-item-renderer";
import {StartedPipe} from './started-pipe';
@Component({
selector: 'todo-list',
pipes: [StartedPipe],
directives: [TodoItemRenderer],
template: `
<div>
<ul>
<li *ngFor="let todo of todoService.todos | started : 'started'">
<todo-item-renderer
[todo]="todo"
(toggle)="todoService.toggleTodo($event)">
</todo-item-renderer>
</li>
</ul>
</div>
`
})
export class TodoList{
@Input() status;
constructor(public todoService: TodoService){}
}
But when I want to use the array arg of my transform value it does not work anymore :
started-pipe.ts
import {Pipe} from '@angular/core';
@Pipe({
name: "started"
})
export class StartedPipe{
transform(value, [status]){
return value.filter((item)=> item.status === status);
}
}
If you have an idea it's welcomed !
Thanks.