Fullcalendar ui-未读取日历配置
Fullcalendar ui-calendar configuration not being read
我开始使用 fullcalendar ui-calendar(angular 版本)。
var app = angular.module('MyApp', ['ui.calendar'])
.controller('MainController', function ($scope) {
var events = [
{ title: "event1", start: new Date(2015, 6, 21) },
{ title: "event2", start: new Date(2015, 7, 31), end: new Date(2015, 8, 02) },
{ title: "event3", start: new Date(2015, 8, 01) },
];
$scope.eventSources = [events];
$scope.calOptions = {
editable: true,
header: {
left: 'prev',
center: 'title',
right: 'next'
}
};
});
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link href="Scripts/fullcalendar-2.3.2/fullcalendar.css" rel="stylesheet" />
<script src="Scripts/jquery-2.1.4.min.js"></script>
<script src="Scripts/jquery-ui-1.11.4.min.js"></script>
<script src="Scripts/moment.js"></script>
<script src="Scripts/angular.js"></script>
<script src="Scripts/fullcalendar-2.3.2/fullcalendar.js"></script>
<script src="Scripts/calendar.js"></script>
<script src="app.js"></script>
<title></title>
<div ng-controller="MainController">
<div class="calendar" ui-calendar="calOptions" ng-model="eventSources"></div>
</div>
问题是配置被忽略了。事件确实发生了......
知道我做错了什么吗?
我制作了 a plunker with your code 并且运行正常。
当它加载配置时,请检查您是否在指令中正确获取配置:
this.getFullCalendarConfig = function(calendarSettings, uiCalendarConfig){
var config = {};
angular.extend(config, uiCalendarConfig);
angular.extend(config, calendarSettings);
angular.forEach(config, function(value,key){
if (typeof value === 'function'){
config[key] = wrapFunctionWithScopeApply(config[key]);
}
});
return config;
};
我开始使用 fullcalendar ui-calendar(angular 版本)。
var app = angular.module('MyApp', ['ui.calendar'])
.controller('MainController', function ($scope) {
var events = [
{ title: "event1", start: new Date(2015, 6, 21) },
{ title: "event2", start: new Date(2015, 7, 31), end: new Date(2015, 8, 02) },
{ title: "event3", start: new Date(2015, 8, 01) },
];
$scope.eventSources = [events];
$scope.calOptions = {
editable: true,
header: {
left: 'prev',
center: 'title',
right: 'next'
}
};
});
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link href="Scripts/fullcalendar-2.3.2/fullcalendar.css" rel="stylesheet" />
<script src="Scripts/jquery-2.1.4.min.js"></script>
<script src="Scripts/jquery-ui-1.11.4.min.js"></script>
<script src="Scripts/moment.js"></script>
<script src="Scripts/angular.js"></script>
<script src="Scripts/fullcalendar-2.3.2/fullcalendar.js"></script>
<script src="Scripts/calendar.js"></script>
<script src="app.js"></script>
<title></title>
<div ng-controller="MainController">
<div class="calendar" ui-calendar="calOptions" ng-model="eventSources"></div>
</div>
问题是配置被忽略了。事件确实发生了...... 知道我做错了什么吗?
我制作了 a plunker with your code 并且运行正常。
当它加载配置时,请检查您是否在指令中正确获取配置:
this.getFullCalendarConfig = function(calendarSettings, uiCalendarConfig){
var config = {};
angular.extend(config, uiCalendarConfig);
angular.extend(config, calendarSettings);
angular.forEach(config, function(value,key){
if (typeof value === 'function'){
config[key] = wrapFunctionWithScopeApply(config[key]);
}
});
return config;
};