将WebApi数据传递给FullCalendar-Angularjs

将WebApi数据传递给FullCalendar-Angularjs,angularjs,asp.net-web-api,fullcalendar,Angularjs,Asp.net Web Api,Fullcalendar,我一直在尝试将webapi返回的值传递给fullcalendar,但它不起作用。似乎fullcalendar是在webapi调用之前加载的,即使调用是在之前进行的 dataService.getItems(baseAddressSchoolCalendar + '/GetSchoolCalendarItems') .success(function (data) { $scope.events = data; }) .error

我一直在尝试将webapi返回的值传递给fullcalendar,但它不起作用。似乎fullcalendar是在webapi调用之前加载的,即使调用是在之前进行的

dataService.getItems(baseAddressSchoolCalendar + '/GetSchoolCalendarItems')
       .success(function (data) {

           $scope.events = data;

       })
       .error(function () {

       });

.
.
.
.
.
.
.
.
$scope.eventSources = [$scope.events];
HTML:



在完成pomise时,即数组长度大于0时,尝试在div元素中使用ng if来呈现指令

<div ui-calendar="uiConfig.calendar" calendar="myCalendar1" class="calendar" data-ng-model="eventSources" ng-if="eventSources.length > 0"></div>


执行该指令的方式是在pomise完成之前进行渲染

fullcalendar==$scope.eventSources
?@RoyMiloh我不明白你的意思。你能更具体一点吗?“…从webapi返回到完整日历”,你的代码中的
fullcalendar
是什么?@RoyMiloh我已经在问题中添加了
html
部分。将
$scope.eventSources=[data]
放在承诺链(
success
方法中,顺便说一句,该方法不推荐)。我如何解决这个问题?我已经做了好几个小时了。
<div ui-calendar="uiConfig.calendar" calendar="myCalendar1" class="calendar" data-ng-model="eventSources" ng-if="eventSources.length > 0"></div>