如何使用AngularJS显示完整的日历动态事件?

时间:2018-06-14 09:55:45

标签: jquery angularjs fullcalendar

从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) {});
}

0 个答案:

没有答案