angularjs - How to display data from AJAX in Angular JS calendar? -
i use following calendar in angular js: angular-bootstrap-calendar
i have ajax method returns dates calendar:
$scope.showschedule = function () { apposervice.getschedule().then(function (response) { calendarservice.set(response.data.calendar, function (){ $scope.refleshcalendar(); }); }); };
inside callback can see method $scope.refleshcalendar();
:
$scope.refleshcalendar = function () { angular.foreach(calendarservice.get(), function (item) { $scope.vm.events.push(item); }); };
this methos prepares data native object $scope.vm.events
, adds dates calendar.
at response ajax array of objects as:
[{title: "ola", type: "info", startsat: "2015-10-31 17:00:00", resizable: true,…},…]
full object is:
{incrementsbadgetotal: true recurson: "year" resizable: true startsat: "2015-10-31 12:00:00" status: "1" title: "ola" type: "info"}
my html code of calendar is:
<mwl-calendar events="vm.events" view="vm.calendarview" view-title="vm.calendartitle" current-day="vm.calendarday" on-event-click="vm.eventclicked(calendarevent)" on-event-times-changed="vm.eventtimeschanged(calendarevent); calendarevent.startsat = calendarneweventstart; calendarevent.endsat = calendarneweventend" auto-open="true" day-view-start="06:00" day-view-end="23:00" day-view-split="30" cell-modifier="vm.modifycell(calendarcell)"> </mwl-calendar>
problems dates ajax not displayed in calendar. tried all...
Comments
Post a Comment