I having troubles using the angular 5 calendar component https://mattlewis92.github.io/angular-calendar
The calendar renders perfectly, including events etc. However, Using mwlCalendarPreviousView and mwlCalendarNextView directives do not work.
Clicking on then do give the following error:
ERROR TypeError: subFn is not a function
at CalendarPreviousViewDirective.onClick (angular-calendar.js:239)
at Object.eval [as handleEvent] (PlanningOverview.html:58)
at handleEvent (core.js:13581)
at callWithDebugContext (core.js:15090)
at Object.debugHandleEvent [as handleEvent] (core.js:14677)
Navigating to the source of that onClick method shows me the following:
/**
* @hidden
* @return {?}
*/
CalendarNextViewDirective.prototype.onClick = function () {
var /** @type {?} */ addFn = {
day: addDays,
week: addWeeks,
month: addMonths
}[this.view];
this.viewDateChange.emit(addFn(this.viewDate, 1));
};
return CalendarNextViewDirective;
Which shows that subFn is indeed not a function.
I must be doing something wrong, but I can't find what...
(I'm using angular-calendar 0.23.2 on Angular 5.0.00)
I had the same issue using Angular 6 and angular-calendar 0.25.2. I was setting the [view]
attribute incorrectly. I had [view]="month"
, but the [view]
MUST be set to a variable in the controller
, e.g. in the HTML: [view]='myView'
and in the controller myView: string = 'month'