angular - FullCalendar 通过 HTTP 检索数据
问题描述
我想通过 HTTP 检索数据的能力来实现 FullCalendar。并且能够从选定的日期打开一个对话框。是否有适合这种实现的库?还是现成的例子?
解决方案
通过 HTTP 提供有关数据的完整详细信息,但您可以调用 API 获取数据,然后将其显示在fullcalendar.io
您可以使用 fullcalendar.io 完成所有这些。
这篇文章涵盖了关于如何打开 Model的讨论。我在下面的例子中添加了它。
以下示例为您提供了一个想法,即在您单击事件以及 Day Box 时显示弹出窗口。
小提琴查看它运行时https://jsfiddle.net/alifaraze/mr53d7nz/27/
<div id="calendar"></div>
<div id="calendarModal" class="modal fade">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span> <span class="sr-only">close</span></button>
<h4 id="modalTitle" class="modal-title"></h4>
</div>
<div id="modalBody" class="modal-body"> </div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
$(document).ready(function() {
$('#calendar').fullCalendar({
events: [{
id: 1,
title: 'Full Day Event - Click Me',
start: '2019-01-02',
end: '2019-01-03',
description: 'Full day event description'
},
{
id: 2,
title: 'Whole Week Event - Click Me',
start: '2019-01-06',
end: '2019-01-10',
description: 'Whole week event description'
}
// more events here
],
eventRender: function(event, element) {
$(element).popover({
title: function() {
return "<B>" + event.title + "</B>";
},
placement: 'auto',
html: true,
trigger: 'click',
animation: 'false',
content: function() {
return "<h3>"+ event.description +"</h3>"
},
container: 'body'
}).popover('show');
},
dayClick: function(date, jsEvent, view) {
$('#modalTitle').html(date.format());
$('#modalBody').html('Clicked on: ' + date.format()
+'<br/>Current view: ' + view.name
+'<br/>Coordinates: ' + jsEvent.pageX + ',' + jsEvent.pageY);
$('#calendarModal').modal();
}
});
})
推荐阅读
- microsoft-graph-api - https://graph.microsoft.com/beta/subscriptions 包括资源数据和加密证书
- amazon-s3 - ansible aws_s3 get_url 操作的最简单示例
- android - NestedScrollView 不滚动我的主要回收视图
- python - 有没有办法使用 alpha vantage api 选择特定类型的数据?(python、alpha vantage、快速 api、请求)
- r - 如何使用excel(xlsx)文件(R语言)通过dplyr包正确实现汇总功能?
- php - 如何使每个项目的轮播都处于活动状态?
- node.js - 如何使用 ssh2-sftp-client fastGet 下载多个文件?
- c# - C#在单元测试中禁用部分功能
- swift - 将 Firebase Firestore 文档值分配给 swift 变量
- c# - Get all users from Microsoft Graph