I'm trying to make a calendar where I will get the information in a request resto in AngularJS. What I want to create a calendar where you give to register your events. With the date of the json attribute it to enter this event and registers an icon that day.
My error is as you can see in the picture it will fetch an array and insert all the fields and not only on the day that was registered to json. My job is repeated 42 times which is the number of squares on the calendar. Does anyone know where is the error in my approach is that I do not understand.
Image
controller
$scope.setDayContent = function(date) {
return $http ({
method : "GET",
url : "app/components/home/controller/test_calendar.json"
}).then(function mySucces(response) {
return response.data.data[0].title;
}, function myError(response) {
$scope.valor = response.statusText;
});
};
json
{"data":[
{"title":"John",
"start":"2016-10-22"
}, {
"title":"Richard",
"start":"2016-10-25"
}
]}
html
<calendar-md flex layout layout-fill
calendar-direction="direction"
on-prev-month="prevMonth"
on-next-month="nextMonth"
on-day-click="dayClick"
ng-model='selectedDate'
week-starts-on="firstDayOfWeek"
tooltips="tooltips"
day-format="dayFormat"
day-content="setDayContent"
></calendar-md>
