title: How to display the events fetched from database on the full calendar angular js directive?
body: <p>Can anybody help me to resolve following error -
  <code>source is undefined</code> and <code>$scope.event is undefined</code> , here are my codes -</p>
  
  <pre><code>    $scope.eventList = function(callback) {
          service.event_list($scope, function (response) {
              var events = [];
              angular.forEach(response,function(event,key){
                  $scope.events.push({
                      id: event.id,
                      title: event.name,
                      start: event.start_date_time
                  });
              });
              callback(events);
              console.log($scope.events);
          });
      }
      $scope.eventSources = [$scope.events, $scope.eventList];
  </code></pre>
  
  <p>I am calling <code>eventList</code> function from my calendar view like this -</p>
  
  <pre><code>&lt;div ng-controller="eventController" data-ng-init="eventList()" class="main-container"&gt;
  </code></pre>
  
  <p><strong>Updated</strong></p>
  
  <pre><code>app.controller('eventController', function($scope,$http, factoryInfo, service, $routeParams, Lightbox, $route, Upload, $compile) {
  
      var date = new Date();
      var d = date.getDate();
      var m = date.getMonth();
      var y = date.getFullYear();
  
      $scope.changeTo = 'Hungarian';
      /* event source that pulls from google.com */
      $scope.eventSource = {
          url: "http://www.google.com/calendar/feeds/usa__en%40holiday.calendar.google.com/public/basic",
          className: 'gcal-event',           // an option!
          currentTimezone: 'America/Chicago' // an option!
      };
  
      $scope.events = [];
  
      $scope.eventList = function(callback) {
  
          service.event_list($scope, function (response) {
              var events = [];
              angular.forEach(response,function(event,key){
                  console.log(event.name);
                  $scope.events.push({
                      id: event.id,
                      title: event.name,
                      start: event.start_date_time
                  });
              });
  
              callback(events);
          });
      }
      $scope.eventSources = [$scope.events, $scope.eventList];
  
          /* $scope.events = [
           {title: 'All Day Event',start: new Date(y, m, 1)},
           {title: 'Long Event',start: new Date(y, m, d - 5),end: new Date(y, m, d - 2)},
           {id: 999,title: 'Repeating Event',start: new Date(y, m, d - 3, 16, 0),allDay: false},
           {id: 999,title: 'Repeating Event',start: new Date(y, m, d + 4, 16, 0),allDay: false},
           {title: 'Birthday Party',start: new Date(y, m, d + 1, 19, 0),end: new Date(y, m, d + 1, 22, 30),allDay: false},
           {title: 'Click for Google',start: new Date(y, m, 28),end: new Date(y, m, 29),url: 'http://google.com/'}
           ];*/
  
          /* event source that calls a function on every view switch */
          $scope.eventsF = function (start, end, timezone, callback) {
              var s = new Date(start).getTime() / 1000;
              var e = new Date(end).getTime() / 1000;
              var m = new Date(start).getMonth();
              var events = [{
                  title: 'Feed Me ' + m,
                  start: s + (50000),
                  end: s + (100000),
                  allDay: false,
                  className: ['customFeed']
              }];
              callback(events);
          };
  
          $scope.calEventsExt = {
              color: '#f00',
              textColor: 'yellow',
              events: [
                  {
                      type: 'party',
                      title: 'Lunch',
                      start: new Date(y, m, d, 12, 0),
                      end: new Date(y, m, d, 14, 0),
                      allDay: false
                  },
                  {
                      type: 'party',
                      title: 'Lunch 2',
                      start: new Date(y, m, d, 12, 0),
                      end: new Date(y, m, d, 14, 0),
                      allDay: false
                  },
                  {
                      type: 'party',
                      title: 'Click for Google',
                      start: new Date(y, m, 28),
                      end: new Date(y, m, 29),
                      url: 'http://google.com/'
                  }
              ]
          };
          /* alert on eventClick */
          $scope.alertOnEventClick = function (date, jsEvent, view) {
              $scope.alertMessage = (date.title + ' was clicked ');
          };
  
          /* Render Tooltip */
          $scope.eventRender = function (event, element, view) {
              element.attr({
                  'tooltip': event.title,
                  'tooltip-append-to-body': true
              });
              $compile(element)($scope);
          };
  
          $scope.changeLang = function () {
              if ($scope.changeTo === 'Hungarian') {
                  $scope.uiConfig.calendar.dayNames = ["Vasárnap", "Hétfő", "Kedd", "Szerda", "Csütörtök", "Péntek", "Szombat"];
                  $scope.uiConfig.calendar.dayNamesShort = ["Vas", "Hét", "Kedd", "Sze", "Csüt", "Pén", "Szo"];
                  $scope.changeTo = 'English';
              } else {
                  $scope.uiConfig.calendar.dayNames = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
                  $scope.uiConfig.calendar.dayNamesShort = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
                  $scope.changeTo = 'Hungarian';
              }
          };
          /* event sources array*/
          $scope.eventSources = [$scope.events, $scope.eventSource, $scope.eventsF];
          $scope.eventSources2 = [$scope.calEventsExt, $scope.eventsF, $scope.events];
  
  
          //clear search field value
          $scope.clearstudentList = function () {
              $scope.searchValue = '';
          }
  
          $scope.page = 1;
          $scope.type = ($routeParams.type) ? ($routeParams.type) : '';
          $scope.event_id = ($routeParams.activity_id) ? ($routeParams.event_id) : '';
          $scope.service = ($routeParams.service) ? ($routeParams.service) : '';
          $scope.serverPath = factoryInfo.serverPath;
  });
  </code></pre>