我在我的应用程序中使用MEAN堆栈,将AngularJS作为我的前端。如何过滤表中的count and quality
值。我想搜索每个计数和质量值...... My Plunker
如果我们选择yarn count
它没有过滤,表格显示为空或Nill,请帮助相同......
HTML: -
<div class="col-md-6 form-group form-group-default">
<label>Count</label>
<select data-ng-model="searchtable.count" id="count" ng-options="item.colorshades[0].count for item in sryarnorders" class="form-control">
<option value="">All</option>
</select>
</div>
<div class="col-md-6 form-group form-group-default">
<label>Quality</label>
<select data-ng-model="searchtable.quality" id="quality" ng-options="item.colorshades[0].quality for item in sryarnorders" class="form-control">
<option value="">All</option>
</select>
</div>
NG-选项: -
ng-options="item.colorshades[0].count for item in sryarnorders"
ng-options="item.colorshades[0].quality for item in sryarnorders"
NG-模块: -
data-ng-model="searchtable.count"
data-ng-model="searchtable.quality"
我的数据: -
$scope.sryarnorders = [
{
"_id": "573d7fa0760ba711126d7de5",
"user": {
"_id": "5721a378d33c0d6b0bb30416",
"displayName": "ms ms"
},
"__v": 1,
"colorshades": [{
"_id": "573d7fc3760ba711126d7de6",
"quality": "Home Textiles",
"count": "yarn count"
},
{
"_id": "579ef3feba3bac040b583b50",
"color": "56a5b6831746bc1c0b391c7c",
"quality": "Hall Textiles",
"count": "carn count"
}],
"created": "2016-05-19T08:56:00.997Z",
"actual_delivery_date": "2016-05-19",
"ex_india_date": "2016-05-19",
"ex_factory_date": "2016-05-19",
"po_delivery_date": "2016-05-19",
"supplier_name": "Fsa",
"buyer_name": "e21"
},
{
"_id": "56ffc6d5ab97a73d1066b798",
"user": {
"_id": "56ff7bece2b9a1d10cd074a3",
"displayName": "saravana kumar"
},
"__v": 1,
"colorshades": [{
"_id": "56ffc723ab97a73d1066b799",
"quality": "Hall Textiles",
"count": "burn count"
}],
"created": "2016-04-02T13:19:17.746Z",
"actual_delivery_date": "2016-04-02",
"ex_india_date": "2016-04-04",
"ex_factory_date": "2016-04-02",
"po_delivery_date": "2016-04-02",
"supplier_name": "Fsa",
"buyer_name": "Binary hand"
},
{
"_id": "56ffc5e0ab97a73d1066b796",
"user": {
"_id": "56ff7bece2b9a1d10cd074a3",
"displayName": "saravana kumar"
},
"__v": 1,
"colorshades": [{
"_id": "56ffc608ab97a73d1066b797",
"quality": "yarn quality",
"count": "carn count"
}],
"created": "2016-04-02T13:15:12.876Z",
"ex_india_date": "2016-04-02",
"ex_factory_date": "2016-04-02",
"po_delivery_date": "2016-04-02",
"supplier_name": "Fsa",
"buyer_name": "e21"
}];
我创建了Plunker作为参考: - plunker
答案 0 :(得分:0)
ng-options
只有count
字符串作为<option>
的值,这是正确的ng-options="item.colorshades[0].count as item.colorshades[0].count for item in sryarnorders"
:
filter:{colorshades: [searchtable]}
否则该值就是所有对象。
但是为了做你想做的事,你需要定义一个新的$ filter或者使用
spy[.indexmday(spy) %in% c(0,1,2,3) & .indexhour(spy) == 6 & .indexmin(spy) %in% (30:50)]