I am trying to groupBy
a date which is a JS date object. I want to group the data per day.
Any ideas how I can do this in a view?
$scope.data = {
messages: [
{
date: new Date(1432811030 * 1000),
message: 'Some text 01'
},
{
date: new Date(1432731600 * 1000),
message: 'Some text 02'
},
{
date: new Date(1432819703 * 1000),
message: 'Some text 03'
}
]
};
And in my view I use:
<div ng-repeat="(key, value) in data.messages | groupBy: 'date'">
<div>{{ key }}</div>
<div ng-repeat="message in value">
<div>{{ message.message }}</div>
</div>
</div>
I have this angular.filter
module included in mu project: https://github.com/a8m/angular-filter
Problem is that I now group per date/time instead of per day. Any idea how?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…