2017-01-04 6 views
0

私は角度uiカレンダーを使用していますが、私は$scope.eventSources私のバックエンドから来るオブジェクトを渡そうとしています。私はオブジェクトが存在することを確認しました。それは次のようになります。角型UIカレンダーはeventSourcesを取得できません

, "eventSources" : [ 
        { 
        "title": 'All Day Test Event', 
        "start": new Date(2017, 0, 10) 
        }, 
        { 
        "title": 'Long Test Event', 
        "start": new Date(2017, 0, 10), 
        "end": new Date(2017, 0, 19) 
        }, 
        { 
        "title": 'Test Appointment', 
        "start": new Date(2017, 0, 10), 
        "end": new Date(2017, 0, 17), 
        "allDay": false 
        } 
       ] 

私は、イベントをハードコードした場合、私はカレンダーは、このようなようなイベントを、示していることを確認することができます

$scope.eventSources = 
      [ 
      [ 
       { 
      title: 'All Day Test Event', 
      start: new Date(2017, 0, 9) 
      }, 
      { 
      title: 'Long Test Event', 
      start: new Date(2017, 0, 10), 
      end: new Date(2017, 0, 12) 
      }, 
      { 
      title: 'Test Appointment', 
      start: new Date(2017, 0, 8), 
      end: new Date(2017, 0, 21), 
      allDay: false 
      } 
      ] 
      ]; 

私はこのような$scope.eventSourcesにオブジェクトを渡すためにしてみてください:

$scope.eventSources = [vm.myPractice[0].eventSources] 

カレンダーには何も表示されません。誰かが体重を入れてもらえますか?

答えて

0

ここに私が見つけた解決策があります。ちょっとハッキリですが、うまくいきました。

 function loadPatient() { 
      $scope.eventSources = vm.myPractice[0].eventSources; 
      uiCalendarConfig.calendars.myCal.fullCalendar('removeEvents'); 
      uiCalendarConfig.calendars.myCal.fullCalendar('addEventSource', vm.myPractice[0].eventSources); 
     } 
関連する問題