我想将可观察数据转换为lowerCase,下面是我的代码。我想将Value转换为小写
import {Pipe} from '@angular/core';
@Pipe({
name: "search"
})
export class SearchPipe {
transform(value, term) {
console.log(term.toLowerCase());
if (term == null) {
return null;
}
return value.filter((item) => {
return item.Email.includes(term) || item.FirstName.includes(term) || item.LastName.includes(term);
});
}
}
答案 0 :(得分:1)
我试过了。它有效。
import {Pipe} from '@angular/core';
@Pipe({
name: "search"
})
export class SearchPipe {
transform(value, term) {
console.log(value);
if (term == null) {
return null;
}
return value.filter((item) => {
return item.Email.toLowerCase().includes(term) || item.FirstName.toLowerCase().includes(term) || item.LastName.toLowerCase().includes(term);
});
}
}