Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ajax request #23

Open
almaweb opened this issue Apr 2, 2015 · 1 comment
Open

Ajax request #23

almaweb opened this issue Apr 2, 2015 · 1 comment

Comments

@almaweb
Copy link

almaweb commented Apr 2, 2015

Awesome job on this. I'm new the Angular but I believe I've poked around enough to get the ajax request working that'll retrieve events from a mysql database via php script and return the events in json format. I'd appreciate any help.

@marsh76
Copy link

marsh76 commented Apr 3, 2015

Retrieve data from your server for events to be displayed in the calendar. Then w/in your controller for the calendar, loop through the results returned from your database, and build out an array of event objects formatted as follows:

var events = [],
i = 0;
for (i = 0; 8 < YourData.length; i += 1) {
events.push({
title: YourData[i].Title,
startTime: YourData[i].StartDateTime,
endTime: YourData[i].EndDateTime,
allDay: YourData[i].AllDay
});
}

$scope.eventSource = events;

****** NOTES: the allDay property is a boolean value. Also, add any additional properties you want to each event object in the events array. In my own implementation, I add an "id" property, representing the unique identifier from the database for a given event, to enable me to link through to more details for that event after selecting the event.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants