2015-09-27 22 views
1

我一直在試圖通過從的WebAPI返回到fullcalendar值,但它無法正常工作。這似乎fullcalendar加載即使在通話之前放置的WebAPI調用之前傳遞的WebAPI數據FullCalendar - Angularjs

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

      $scope.events = data; 

     }) 
     .error(function() { 

     }); 

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

HTML:

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

enter image description here

enter image description here

+0

'fullcalender == $ scope.eventSources'? –

+0

@RoyMiloh我不明白你的意思。你可以說得更詳細點嗎。 – uikrosoft

+0

「..從webapi返回到fullcalendar」,代碼中的「fullcalendar」是什麼? –

回答

1

嘗試NG-如果在div元素,以便在完成任務時呈現指令,即,當數組的長度大於0時。

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

您在做指令的方式是在pomise完成之前呈現。

+0

我該如何解決這個問題?我已經在這上好幾個小時了。 – uikrosoft

+0

我編輯答案更清晰。 –

+0

它的工作!謝謝。你是最棒的。 – uikrosoft