twinssbc / AngularJS-ResponsiveCalendar

A pure AngularJS responsive calendar directive
http://twinssbc.github.io/AngularJS-ResponsiveCalendar/demo/
MIT License
112 stars 77 forks source link

rangeChanged not triggering #53

Closed captainmorgan0 closed 8 years ago

captainmorgan0 commented 8 years ago

Here is my HTML: <calendar ng-model="currentDate" calendar-mode="calendarMode" event-source="bookingSource" query-mode="remote" range-changed="rangeChanged(startTime, endTime)" event-selected="onEventSelected(event, $event)"></calendar>

and here is what I have in my controller: $scope.rangeChanged = function (startTime, endTime) { Events.query({ startTime: startTime, endTime: endTime }, function (events) { console.log("THIS IS A TEST"); $scope.eventSource = events; }); };

When I run my code, the "THIS IS A TEST" log message does not appear, which tells me the rangeChanged function is not fired. Am I doing something wrong?

twinssbc commented 8 years ago

@captainmorgan0 I notice that you put the log method in Events.query call. Could you move it out to see if the log will be printed or not? Also under what circumstance do you mean it is not triggered? At the load time? When you slide to the next month? Another thing worth to check is if you put the calendar into some directive having the isolated scope, so that it can't bind the method into your controller.

captainmorgan0 commented 8 years ago

I have tried moving the log as the first line in rangeChanged function and it still does not print out. I mean the rangeChanged function is not triggered when you click month, day or week or when you go to the next or previous month. As for putting the calendar in a directive having isolated scope, I'm not sure how that is done. Is there any other way to load the data one month at a time?

twinssbc commented 8 years ago

@captainmorgan0 I think I know what's wrong. Could you assign the query-mode to a variable? It doesn't support directly specify the value in html.

captainmorgan0 commented 8 years ago

Yes, that was the problem. thanks