我有一个对象数组,我希望使用角度$filter
SensorPort: [0: {Port: "1"SensorLabel: "Temperature"},1: {Port: "2"SensorLabel: ""},2: {Port: "3"SensorLabel: ""}]
答案 0 :(得分:1)
不确定,你想要实现什么。考虑一下你的数据:
var sensorPortData = [{Port: "1", SensorLabel: "Temperature"},
{Port: "2", SensorLabel: "Attempt"},
{Port: "3", SensorLabel: "Nothing"}];
然后这样做,会给你:
var searchQuery = "Tem";
$filter('filter')(myData, {$: searchQuery}) == [{Port: "1", SensorLabel: "Temperature"},
{Port: "2", SensorLabel: "Attempt"}]