【发布时间】:2020-07-12 09:43:40
【问题描述】:
我的 tags.ts 文件中有这些数据,但我不确定如何使用该名称进行过滤。我能够使用普通的字符串列表来做到这一点,但不知道如何为数组做到这一点。任何建议或帮助,如何做到这一点。
export const tags2: Array<Tag> = [{name: "Lam", superTag: true},
{name: "Eliz", superTag: false},
{name: "Cathy", superTag: true},
{name: "John", superTag: false},
{name: "James", superTag: false},
{name: "David", superTag: false}];
以下代码适用于普通字符串列表,但不适用于数组
import { tags2 } from "./tags.data";
this._filteredTags = this.tags.filter((v: string) =>
v.toLowerCase().includes(filterValue.toLowerCase().trim())
);
}
}
【问题讨论】:
标签: html css arrays angular filtering