我有两个不同的数组列表,其中包含不同的对象,需要根据创建日期创建一个列表。
聊天消息:-
[{
"creationDate": "2016-05-18 09:21:39",
"creationUser": "#12:41",
"message": "sssss",
"userEmail": "miaai.abc@aail.com",
"userName": "Miaai",
"userSurname": "dsith",
"isRead": false,
"dossierId": "#88:1"
}, {.. so on ..}]
文档列表:-
[{
"name": "Hamlet.abook",
"title": "Hamlet.abook",
"inCompleteMetaData": true,
"creationDate": "2016-05-17 11:25:23",
"creationUser": "#12:41"
},{so on ...}]
输出将基于创建日期
[{
"name": "Hamlet.abook",
"title": "Hamlet.abook",
"inCompleteMetaData": true,
"creationDate": "2016-05-17 11:25:23",
"creationUser": "#12:41"
},{
"creationDate": "2016-05-18 09:21:39",
"creationUser": "#12:41",
"message": "sssss",
"userEmail": "miaai.abc@aail.com",
"userName": "Miaai",
"userSurname": "dsith",
"isRead": false,
"dossierId": "#88:1"
}]
最佳答案
在underscorejs中使用union http://underscorejs.org/#union
_.union([1, 2, 3], [101, 2, 1, 10], [2, 1]);
=> [1, 2, 3, 101, 10]
关于jquery - 使用 angularjs 根据日期合并两个不同的数组列表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37314969/