I'm using timetable.js together with an angular router and firebase for the backend. My code looks like this:
That is the html file that angular routes to:
<div class="timetable" ng-init="initTimetable()"></div>
That's the file where I handle all my functions from that router:
myApp.controller('myController', function($scope) {
$scope.initTimetable = function() {
var timetable = new Timetable();
timetable.setScope(8, 14);
timetable.addLocations(['Place 1', 'Place 2', 'Place 3']);
timetable.addEvent('Homework', 'Place 1', new Date(2016,9,10,11,45), new Date(2016,9,10,12,30));
var renderer = new Timetable.Renderer(timetable);
renderer.draw('.timetable');
};
});
What I'm now trying to do is to run that timetable.addEvent() function outside that controller.
I hope somebody understood, what I'm trying to do and can help me.
Thanks!