Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AngularJS ui-calendar – model with events

I’m trying to set up a calendar according to the instructions. The calendar itself shows up on the page, but it doesn’t display any events.

Code in template:

<div ui-calendar ng-model="eventSources">

Code in my controller:

var date = new Date();
var d = date.getDate();
var m = date.getMonth();
var y = date.getFullYear();

$scope.eventSources = [
    {
    "title": 'All Day Event',
    "start": new Date(y, m, d)},
{
    "title": 'Long Event',
    "start": new Date(y, m, d - 5),
    "end": new Date(y, m, d - 2)}];

When I loop through eventSources in the template it works:

<li ng-repeat="e in eventSources">
    {{e.title}} {{e.start}}
</li>

The calendar doesn’t show anything, though. There are no errors in console, too. Does any of you has an idea of what’s going on here?

like image 427
Piotr Mierzejewski Avatar asked Feb 17 '23 04:02

Piotr Mierzejewski


1 Answers

Using Just an array of events is the issue here. uiCalendar only takes an array of eventSources. http://arshaw.com/fullcalendar/docs/event_data/eventSources/

I believe that we should make it flexible enough to allow for all of the api sources however.

like image 120
joshkurz Avatar answered Feb 28 '23 06:02

joshkurz