从Web服务获取数据并将响应放入calendarlist
变量中。下面是我的示例代码。谢谢。
<div id="calendar"
ui-calendar="uiConfig.calendar"
class="span8 calendar"
ng-model="calEvents"></div>
$scope.calender1 = function() {
$scope.events = [];
//getting data from server
$http({
//web service calling here
}).then(function successCallback(response) {
//response is json array
var calendarlist;
$scope.calendarlist = response.data.result;
//for loop for event display
for (var i = 0; i < $scope.calendarlist.length; i++) {
$scope.events[i] = {
title: $scope.calendarlist[i].Schedulername,
start: $scope.calendarlist[i].startdate,
};
}
//initalizing the array
$scope.eventSources = [$scope.events];
console.log("$scope.eventSources" + $scope.eventSources);
}, function errorCallback(response) {});
}