I want to collect past chats with a limit, but this prints out all the chats.
<div ng-repeat="(key, value) in chats|limitTo:10">
<a href="" ng-click="ind(key, value);$event.preventDefault()" class="list-group-item">
<span class="badge">{{value.time}}</span>
<i class="fa fa-fw fa-calendar"></i> {{value.partner}}
</a>
</div>
This is the code in the controller.
$scope.chats = null;
var chats = {}
var id = $store.get('doctor_id');
var d = new Date();
doctorFactory.getChatRooms(id).then(function(x){
for (var i in x){
chats[i] = { partner: x[i] }
}
$scope.chats = dateService.doEquation(chats, d);
console.log($scope.chats);
}).catch(function(err){
console.log(err);
});
console.log($scope.chats)
prints out a series of objects:
2016021085524: Object
clock: "10:15"
date: "02/10/2016"
partner: "Magruder_Douglas"
time: "0 years ago"
2016021085622: Object
clock: "10:21"
date: "02/10/2016"
partner: "Magruder_Douglas"
time: "0 years ago"