我有一个多维数组,正在解析为 JSON,我想在 AngularJS 中“排序”。我收到此错误:错误:[orderBy:notarray]预期数组但收到:13
<div ng-repeat="x in thread track by x.Id | orderBy: x.Id">
这是我的 JSON:
{
"13": {
"Id": 16,
"LINK_Id": 16,
"Attachments": [
{
"AttachmentName": "Attachment.jpeg",
"AttachmentLinkId": 6,
"LinkType": "Thread",
"ThreadId": 20
},
{
"AttachmentName": "Attachment.txt",
"AttachmentLinkId": 7,
"LinkType": "Thread",
"ThreadId": 20
}
]
},
"16": {
"Id": 16,
"LINK_Id": 169
},
"19": {
"Id": 19,
"LINK_Id": 112
} }
如果有人能提供帮助,我们将不胜感激。
非常感谢,
最佳答案
使用 orderBy Go through this 时有一些限制和规则。 迭代对象的对象(充当关联数组或哈希)
这个标题就是您想要实现的目标。
关于javascript - AngularJS 多维数组排序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42299018/