我在使用角度 5 日历组件时遇到问题 https://mattlewis92.github.io/angular-calendar
日历完美呈现,包括事件等。但是,使用 mwlCalendarPreviousView 和 mwlCalendarNextView 指令不起作用。
单击然后确实给出以下错误:
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 0.23.0.00 上使用角度日历 5.0.00(
我在使用 Angular 6 和角度日历 0.25.2 时遇到了同样的问题。我错误地设置了[view]
属性。我有[view]="month"
,但[view]
必须设置为controller
中的变量,例如在 HTML: [view]='myView'
和控制器myView: string = 'month'
[view]="month" 更改为 view="month">