how do I use two pipes sequentially?
<div class="thread" *ngFor="thread of threadlist | bookmarkPipe | threadPipe"></div>
In specific my threads have a bookmark:boolean property as well as tag properties (unit,task,subtask). So what I want to achieve is that the first pipe filters all threads which are bookmarked, then apply the 2nd pipe (below)
export class ThreadPipe implements PipeTransform{
transform(array:Thread[], [unit,task,subtask]):any{
//See all Threads
if(unit == 0 && task == 0 && subtask == 0){
return array
}
//See selected Units only
if(unit != 0 && task == 0 && subtask == 0){
return array.filter(thread => {
return thread.unit === unit;
});
}
//See selected Units and Tasks
if (unit != 0 && task != 0 && subtask == 0){
return array.filter(thread => {
return thread.unit === unit && thread.task === task;
});
}
// See selected units, tasks, subtask
if (unit != 0 && task != 0 && subtask != 0){
return array.filter(thread => {
return thread.unit === unit && thread.task === task && thread.subtask === subtask;
});
}
}
}