Angularjs FullCalendar-基于所选日期,使用
嘿,伙计们,我对完整的日历还不太熟悉。我目前正在使用angular v1.3.15 我想做的就是用- 1) 只有标题(Angularjs FullCalendar-基于所选日期,使用,angularjs,fullcalendar,Angularjs,Fullcalendar,嘿,伙计们,我对完整的日历还不太熟悉。我目前正在使用angular v1.3.15 我想做的就是用- 1) 只有标题(fc标题。没有fc内容) 2) 默认情况下,标题仅显示Agenday视图(带有prev和next按钮)。目前,我已将其添加到我的完整日历代码中 defaultView: 'agendaDay' 3) 我还想将当前选定的日期传递给控制器,以便根据选定的日期填充列表 这是我想要实现的目标- 这就是我的FullCalendar脚本的样子- var date = new Date
fc标题
。没有fc内容
)2) 默认情况下,标题仅显示Agenday视图(带有prev和next按钮)。目前,我已将其添加到我的完整日历代码中
defaultView: 'agendaDay'
3) 我还想将当前选定的日期传递给控制器,以便根据选定的日期填充列表
这是我想要实现的目标-
这就是我的FullCalendar脚本的样子-
var date = new Date();
var d = date.getDate();
var m = date.getMonth();
var y = date.getFullYear();
var calendar2 = $('#calendar2').fullCalendar({
defaultView: 'agendaDay',
header: {
left: 'prev,next today',
center: 'title',
right: ''
},
selectable: true,
selectHelper: true,
select: function(start, end, allDay) {
},
editable: true
});
为了隐藏fc内容
,我将类.fc内容的显示调整为无
,目前效果良好
任何建议都将不胜感激。任何其他使任务更简单的插件或angular指令也可以工作基本上,我只想根据用户使用angular选择的日期显示列表
------------更新的v1------到目前为止,我这样做是为了传递数据。问题是FullCalendar内容是动态生成的
scope.getStatuses = function(current_date) {
// HTTP GET request - to fetch all the statuses for a particular day
var req = {
method: "GET",
//url: 'http://where-is-everyone.herokuapp.com/api/v1/statuses?date=2015-04-27',
url: 'http://where-is-everyone.herokuapp.com/api/v1/statuses?date='+current_date
};
http(req).success(function(data, status){
scope.status = status;
scope.data = data;
scope.rowCollection = data.message;
}).
error(function(data, status){
scope.data = data || "Request failed";
scope.status = status;
});
};
$('.fc-button-prev').click(function(){
var current_date = $('#calendar2').fullCalendar( 'getDate' );
scope.formatted_current_date = $.fullCalendar.formatDate(current_date, "yyyy-MM-dd");
scope.getStatuses(scope.formatted_current_date);
});
$('.fc-button-next').click(function(){
var current_date = $('#calendar2').fullCalendar( 'getDate' );
scope.formatted_current_date = $.fullCalendar.formatDate(current_date, "yyyy-MM-dd");
scope.getStatuses(scope.formatted_current_date);
});
这就是工作,但我观察到使用DevTool所花费的时间,大约需要400-600毫秒,这相当慢
有没有办法加快速度?因为它是直角的,我想使用绑定使它更快。这是我想到的(因为FullCalendar是动态生成的),但我不确定这样做是否正确
$(".fc-button-next").html(
compile(
"<span ng-click='changeListName()' class='fc-button fc-button-next fc-state-default fc-corner-right'><span class='fc-button-inner'><span class='fc-button-content'> ► </span><span class='fc-button-effect'><span></span></span></span></span>"
)(scope)
);
scope.changeListName = function() {
var current_date = $('#calendar2').fullCalendar( 'getDate' );
scope.formatted_current_date = $.fullCalendar.formatDate(current_date, "yyyy-MM-dd");
scope.getStatuses();
};
$(.fc按钮下一步”).html(
编撰(
" ► "
)(范围)
);
scope.changeListName=函数(){
var current_date=$('#calendar2')。fullCalendar('getDate');
scope.formatted_current_date=$.fullCalendar.formattate(当前日期,“yyyy-MM-dd”);
scope.getStatuses();
};
是否可以启动小提琴并运行演示?列表应该是什么样的?它由什么组成?你能给我们一个小提琴,上面有数据吗?或者你只是想知道如何将选定的日期从FC传递给你的控制器吗?它只是一个普通的ng重复表列表,工作正常。到目前为止,数据尚未显示的日期o被抓取是硬编码的。将来我需要从完整日历日期动态获取日期并传递它。获取日期是我需要帮助的地方。其余的都已经处理好了,所以我想知道如何从完整日历中隐藏fc内容
?而不必像现在那样进行修补。我不太擅长使用ngular,所以我不会直接回答这个问题。但是回调是从FC获取日期更改的最佳方式(只要按下prev
/next
按钮,它就会触发)。开始/结束在视图
参数中。