我在使用angular 5日历组件https://mattlewis92.github.io/angular-calendar时遇到了问题
日历呈现完美,包括事件等。但是,使用mwlCalendarPreviousView和mwlCalendarNextView指令不起作用。
单击then do会出现以下错误:
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)
导航到该onClick方法的源代码,我可以看到以下内容:
/**
* @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;
这表明subFn确实不是一个函数。
我一定是做错了什么,但我找不到...
(我在Angular 5.0.00上使用的是angular-calendar 0.23.2 )
发布于 2018-05-21 00:23:16
我使用Angular 6和angular-calendar 0.25.2也遇到了同样的问题。我错误地设置了[view]
属性。我有[view]="month"
,但必须在controller
中将[view]
设置为变量,例如在HTML:[view]='myView'
和控制器myView: string = 'month'
中
https://stackoverflow.com/questions/48223713
复制相似问题