简体   繁体   中英

How to group json data on the basis of the date in angular?

我基本上想做的是,我有多个json对象,根据日期数据,我必须以数组的形式对数据进行分组,使日期成为关键。

It can be done using few lodash function. The code is below `

 var temp1 = _.chain(res.data.events)
                    .orderBy('createdAt', 'asc')
                    .groupBy(function(o) {
                        return moment(o.createdAt).format('DD/MM/YYYY')
                    }).value()

`

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM