【发布时间】:2017-12-04 15:22:25
【问题描述】:
我正在尝试包含 angular ui-calendar 组件。我按照网站的步骤 1.https://github.com/angular-ui/ui-calendar 和 2.http://www.oodlestechnologies.com/blogs/Fullcalendar-Walk-through-with-AngularJS
通过
安装组件bower install angular-ui-calendar
在 html 文件中加载组件
<link rel="stylesheet" href="bower_components/fullcalendar/dist/fullcalendar.css"/>
包含对应用程序的依赖
var app = angular.module('myCalendarApp', ['ui.calendar'])
在 UI 中插入就像
<div ui-calendar="uiConfig.calendar" ng-model="eventSources" calendar="myCalendar"></div>
在控制器中创建静态事件和配置
$scope.eventSources = [];
$scope.uiConfig = {
calendar:{
height: 450,
editable: true,
header:{
left: 'month basicWeek basicDay agendaWeek agendaDay',
center: 'title',
right: 'today prev,next'
},
eventClick: $scope.eventClick
}
};
$scope.eventClick = function(event){
alert("Clicked event === "+event.title);
};
var events = [
{title: 'All Day Event',start: new Date('Sun Dec 17 2017 09:00:00 GMT+0530 (IST)')},
{title: 'Long Event',start: new Date('Thu Dec 21 2017 10:00:00 GMT+0530 (IST)'),end: new Date('Thu Dec 21 2017 17:00:00 GMT+0530 (IST)')},
{id: 999,title: 'Repeating Event',start: new Date('Mon Dec 4 2017 09:00:00 GMT+0530 (IST)'),allDay: false}
];
$scope.eventSources = [events];
当我尝试在浏览器中验证日历时,它会抛出以下错误
TypeError: calendar.fullCalendar is not a function
at Scope.scope.initCalendar (calendar.js:286)
at Object.fn (calendar.js:358)
at Scope.$digest (angular.js:15896)
at Scope.$apply (angular.js:16160)
at WindowsCtrl.window.showDialog.$scope.showDialog (controller.js:690)
at HTMLSpanElement.onclick (VM4670 windows:1)
谁能帮我解决这个问题。
【问题讨论】:
-
您是否加载了 fullcalendar.js 文件?
-
是的。似乎只包含css。
<script src="fullcalendar.js"></script>在哪里? -
我已经包含了所有必要的脚本和css文件@rolodex
标签: javascript jquery angularjs fullcalendar