嵌套对象过滤-角度 [英] Nested object filtering - Angular
问题描述
现在,我有一个包含对象内部对象的复杂对象数组.我正在尝试使用输入字段来过滤列表(以ng-repeat的形式),但是由于某些原因,我只能从顶层获得结果.
Right now I have an array of complex objects that have objects inside of objects. I'm trying to use an input field to filter down the list (in an ng-repeat), but for some reason I'm only getting results from the top level.
[
{
"id": 1,
"guid": "a97f722e-cef4-a125-351b-77c281c88556",
"groups": [
{
"name": "Another Test",
"id": 1
},
{
"name": "Angular",
"id": 9
}
],
"addresses": [
{
street: "123 Test Ave",
city: "New York",
state: "New York"
}
]
},
{
"id": 2,
"guid": "a97fbbbb-cccc-a125-351b-77c281c88556",
"groups": [
{
"name": "Garbage",
"id": 2,
"stuff": [
{
"name": "Dennis",
"anothernest": [
{
"test": "Bob"
},
{
"test": "Bob2"
}
]
}
]
},
{
"name": "Test",
"id": 7
}
],
"addresses": [
{
"street": "345 Test Ave",
"city": "Los Angeles",
"state": "California"
}
]
}
]
这是一个相似的结构(尽管已简化).出于某种原因,尽管我可以毫无疑问地基于搜索过滤这些嵌套对象: http://jsfiddle.net/7aeL2yd2/
This is a similar structure (albeit simplified). For some reason though I have no problem filtering any of these nested objects based on a search: http://jsfiddle.net/7aeL2yd2/
什么会阻止我在更大的数据结构上执行此操作?
What would prevent me from doing this on a bigger data structure?
编辑 看起来这是一个Angular 1.3问题.它适用于1.2,但是当我将其升级到1.3(就像我的应用程序一样)时,它不再起作用. http://jsfiddle.net/7aeL2yd2/2/
推荐答案
此问题已于7天前在GitHub上提出:
This issue was raised seven days ago on GitHub:
它看起来像是在12小时前已检查的修复程序:
And it looks like a fix for it was checked in 12 hours ago:
修复(filterFilter):使 $
与更深层的属性匹配级别
fix(filterFilter): make $
match properties on deeper levels as well
我真的不知道AngularJS的构建工作流程是如何工作的,也不知道它们如何发布全新的版本,但是无论如何,看来您正在解决这个问题.同时,也许您可以使用1.2版?
I don't really know how AngularJS's build workflow works or how they release brand new versions, but at any rate, it looks like a solution for your issue is on the way. In the meantime, perhaps you can get by with version 1.2?
这篇关于嵌套对象过滤-角度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!