我的问题是我想使用数字过滤器代替字符串过滤器。什么是代码行?
import { PipeTransform, Pipe } from '@angular/core';
import {index} from './index';
@Pipe({
name:'bookFilter',
})
export class BookFilterPipe implements PipeTransform
{
transform(value:index[],filterBy:any):index[]
{
filterBy=filterBy?filterBy.toLocaleLowerCase():null;
return filterBy?value.filter((book:index)=>
book.Name.toLocaleLowerCase().indexOf(filterBy)!==-1):value
// here I want to use year filter in that line.
// like **book.year** what will be full line of code in that place
}
}