Hi Ahmed,
Don't try to solve this in the template. While it is possible, you will
offload a lot of complexity into your template that does not belong there.
do something like this in your controller. (For your reference, if you have
an $http call in your controller, that is a sure sign you need a
service/factory, as a rule of thumb, don't do $http in a controller)
$http.get("/api/Test").success(function (data) {
var dataByMonth = [];
data.forEach(itemToMonth);
$scope.customers = dataByMonth;
function itemToMonth(item) {
var month = item.MyDate.getMonth;
dataByMonth[month] = dataByMonth[month] || [];
dataByMonth[month].push(item);
}
});
Then you can simply nest the repeat, and be done with it.
When you have difficulties doing this, set up a plunk
<http://plnkr.co/edit/tpl:bSBatno6Z85VMCtxF4KK>, and I will take a look for
you.
Regards
Sander
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.