【问题标题】:Fullcalendar ui-calendar configuration not being read未读取 Fullcalendar ui-calendar 配置
【发布时间】:2015-07-29 07:09:50
【问题描述】:

我开始使用 fullcalendar ui-calendar(角度版本)。

    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>

问题是配置被忽略了。事件确实发生了…… 知道我做错了什么吗?

【问题讨论】:

    标签: angularjs fullcalendar


    【解决方案1】:

    我创建了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;
          };
    

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-09-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-07-06
    • 2020-05-09
    相关资源
    最近更新 更多