angular.module('lightning')
.controller('ExampleController', ['$scope','$timeout','ResponseService', function($scope,$timeout,ResponseService) {
$scope.response = {
page: 2,
query: {
rpp: 50,
filters:[]
},
facets: {
test1: {
filters: [
{
val: {
dsp: 'Day 1',
act: 'Day 1',
},
count: 100,
},
{
val: {
dsp: 'Day 2',
act: 'Day 2',
},
count: 200,
}
],
'max-count':'200'
},
test2: {
filters: [
{
val: {
dsp: 'Day 1',
act: 'Day 1',
},
count: 10,
},
{
val: {
dsp: 'Day 2',
act: 'Day 2',
},
count: 20,
}
],
'max-count':20
},
test3: {
filters: [
{
val: {
dsp: 1288323623006,
act: 1288323623006,
},
count: 10,
},
{
val: {
dsp: 1288323723006,
act: 1288323723006,
},
count: 20,
}
],
'max-count':20
},
date:{
filters:[],
'max-count':100
}
},
results: []
}
var i = 0;
while(i < 99){
var CurrentDate = new Date();
CurrentDate.setMonth(CurrentDate.getMonth() + i);
$scope.response.facets.date.filters.push(
{
val : {
dsp:CurrentDate,
act:CurrentDate
},
count:Math.floor(Math.random()*(100-1+1)+1),
}
)
i++
}
console.log($scope.response.facets.date);
ResponseService.setResponse('response', $scope.response);
}]);