我的 JSON 数据如下:records.json
[
{
"id":"1",
"name":"Report1",
"category":"A"
},
{
"id":"2",
"name":"Report2",
"category":"A"
},
{
"id":"3",
"name":"Report3",
"category":"B"
},
{
"id":"4",
"name":"Report4",
"category":"C"
}
]
HTML页面就像:
<input ng-model="query" />
<li ng-repeat="record in records | filter:query" />
此代码根据查询给出记录列表,但我只想要那些只有类别 A 的记录。