javascript - 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",
"isWorkDay": false,
"budgetDailyNumber": 0,
"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
}
推荐阅读
- loopbackjs - loopback 4 警告:关系数据库不支持 {strict: false} 模式。{strict: true} 模式将为模型地址设置
- amazon-web-services - Cloudwatch 中 ECS 的 CPU 利用率与 docker stats 不同
- oracle - 如何从 linux mint 终端连接到 Oracle 数据库?
- c# - VLC 下 mp4 文件的持续时间不正确
- java - Stream.count() 如何处理 Spring 存储库查询?
- jquery - 使用 jQuery 从表中的第二个 td 中选择超链接文本
- java - VS Code 知道 Scala 和 Java,但无法连接它们
- boolean-algebra - 需要帮助理解布尔表达式
- excel - 在任何行插入新行后自动填充公式(此工作簿或工作表的 VBA,而不是宏模块按钮)
- ios - 找到合适的图像;代码 13.3