Skip to content
This repository has been archived by the owner on Sep 8, 2020. It is now read-only.

Adding AMD support #477

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "angular-ui-calendar",
"version": "1.0.2",
"version": "1.0.4",
"description": "A complete AngularJS directive for the Arshaw FullCalendar.",
"author": "https://github.com/angular-ui/ui-calendar/graphs/contributors",
"license": "MIT",
Expand Down
41 changes: 25 additions & 16 deletions src/calendar.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,22 @@
*
*/

angular.module('ui.calendar', [])

.constant('uiCalendarConfig', {
calendars : {}
})
.controller('uiCalendarCtrl', ['$scope', '$locale',
function ($scope, $locale) {
(function(global, factory) {
if (typeof define === "function" && define.amd) {
define(['angular', 'jquery', 'moment', 'fullcalendar'], factory);
} else if (typeof exports === "object") {
module.exports = factory(require('angular'), require('jquery'), require('moment'), require('fullcalendar'));
} else {
global.uiCalendarDirective = factory(global.angular, global.jQuery, global.moment, global.fullcalendar);
}
})(this, function(angular, $) {
'use strict';
angular.module('ui.calendar', [])

.constant('uiCalendarConfig', {
calendars : {}
})
.controller('uiCalendarCtrl', ['$scope', '$locale', function ($scope, $locale) {

var sources = $scope.eventSources;
var extraEventSignature = $scope.calendarWatchEvent ? $scope.calendarWatchEvent : angular.noop;
Expand Down Expand Up @@ -44,8 +53,8 @@ angular.module('ui.calendar', [])
}

var extraSignature = extraEventSignature({
event : e
}) || '';
event : e
}) || '';
var start = moment.isMoment(e.start) ? e.start.unix() : (e.start ? moment(e.start).unix() : '');
var end = moment.isMoment(e.end) ? e.end.unix() : (e.end ? moment(e.end).unix() : '');

Expand Down Expand Up @@ -227,10 +236,8 @@ angular.module('ui.calendar', [])

return {};
};
}
])
.directive('uiCalendar', ['uiCalendarConfig',
function (uiCalendarConfig) {
}])
.directive('uiCalendar', ['uiCalendarConfig', function (uiCalendarConfig) {

return {
restrict : 'A',
Expand Down Expand Up @@ -360,6 +367,8 @@ angular.module('ui.calendar', [])
});
}
};
}
]
);
}]);
});
function factory(angular, moment, fullcalendar) {

}