FullCalendar:在调用RestAPI调用后将JSON数据与initialEvents绑定

问题描述

运行角度全日历控制项目,该项目可在作者网站上获得。 我正在从服务器以JSON形式在数组中获取事件(API ref),然后希望与initialEvents(API ref)绑定。我该如何实现?

[
  {
    "id": 202081,"start": "2020-08-01","isWorkDay": false,"budgetDailyNumber": 0,"modifiedBudgetDailyNumber": 0
  },{
    "id": 202082,"start": "2020-08-02","modifiedBudgetDailyNumber": 0
  }
]

解决方法

这是解决方案:

events: {
  url: 'type URL here',method: 'GET',// extraParams: {
  //   custom_param1: 'something',//   custom_param2: 'somethingelse'
  // },failure: function() {
    alert('there was an error while fetching events!');
  },color: 'yellow',// a non-ajax option
  textColor: 'black' // a non-ajax option
}