0
我試圖讓日曆工作在離子應用程序上,通過bower安裝日曆和moment.js,但我得到錯誤,它說TypeError :d不是一個函數。它把我帶到「var previousDate = moment(vm.viewDate);」在mwlCalendar.js:35angular-bootstrap-calendar TypeError:d不是函數
.controller('profileCtrl', function($scope, $state, User, calendarConfig, moment) {
//Calendar Stuff
$scope.calendarView = 'day';
$scope.viewDate = new Date();
var test = new Date('9/20/2016');
console.log(moment());
$scope.calendarTitle = "Test Calendar";
//test data
$scope.events = [{
title: 'My event title', // The title of the event
startsAt: new Date(2016, 10, 1, 1), // A javascript date object for when the event starts
endsAt: new Date(2016, 10, 26, 15), // Optional - a javascript date object for when the event ends
color: { // can also be calendarConfig.colorTypes.warning for shortcuts to the deprecated event types
primary: '#e3bc08', // the primary event color (should be darker than secondary)
secondary: '#fdf1ba' // the secondary event color (should be lighter than primary)
},
actions: [{ // an array of actions that will be displayed next to the event title
label: '<i class=\'glyphicon glyphicon-pencil\'></i>', // the label of the action
cssClass: 'edit-action', // a CSS class that will be added to the action element so you can implement custom styling
onClick: function(args) { // the action that occurs when it is clicked. The first argument will be an object containing the parent event
console.log('Edit event', args.calendarEvent);
}
}],
draggable: false, //Allow an event to be dragged and dropped
resizable: false, //Allow an event to be resizable
incrementsBadgeTotal: true, //If set to false then will not count towards the badge total amount on the month and year view
cssClass: 'a-css-class-name', //A CSS class (or more, just separate with spaces) that will be added to the event when it is displayed on each view. Useful for marking an event as selected/active etc
allDay: false // set to true to display the event as an all day event on the day view
}];
}
<div class="calendar" ng-hide="profile">
<mwl-calendar view="calendarView" view-date="viewDate" events="events" view-title="calendarTitle">
</mwl-calendar>
</div>
發佈的代碼的其餘部分周圍可能有幫助的讀者看到究竟發生了什麼。現在,任何外部的人都不可能看到發生了什麼事情。另外,我建議嘗試使用Chrome,進入開發人員模式並單步執行代碼。學習如何使用Chrome進行調試可能需要一些時間,但它是值得的。 – Dale
發佈我的html和控制器的日曆 – jayxC
如果觀衆可能覺得它有用,請將其作爲答案發布給自己。 – Dale