使用 PrimeNG Schedule 在平均 angular4 应用程序中导入 FullCalendar

Import FullCalendar in a mean angular4 application with PrimeNG Schedule

我正在 运行 一个 Angular4 平均应用程序,我想使用 PrimeNG Schedule to show events in a calendar. Schedule is build on FullCalendar,它反过来需要 jQuery 和 Moment.js 才能工作。我使用了 ap-ng2-fullcalendar 版本,因为它与 Angular4 更兼容。

所以我用 npm 安装了 jQuery、Moment、FullCalendar 和 primeNG Scedule。

我已将这些导入内容放入 app.module.ts

import {CalendarModule} from "ap-angular2-fullcalendar";
import {ScheduleModule} from 'primeng/components/schedule/schedule';

(在进口中:[...])

并在 html 组件(PrimeNG 指令)中添加:

<p-schedule [events]="projects"></p-schedule>

但是当我 运行 项目时出现错误:

ERROR ReferenceError: jQuery is not defined

如何在我的应用程序中获取 jQuery(和 Moment)?我可以将 jquery.js 文件从 node_module/jquery/dist 复制到我的 public 文件夹并将其添加到 html,如下所示:

<script src="/js/plugins/jquery.js"></script>

但这可能不是正确的方法,然后我在 运行 启动项目时得到了这个:

TypeError: this.schedule.fullCalendar is not a function

我估计我的项目中缺少一些 js 文件,jQuery 和 Moment 需要某种手动导入但不知道如何导入。 注:我用的是webpack。

谢谢!

我在 webpack 中使用 typescript。我想我现在明白了,这是一个错误 https://github.com/moment/moment/issues/4228 and some misunderstanding on my side of how to import 3th party libraries that have no TypeScript (type) Definition. The ap-ng2-fullcalendar module actually neatly makes FullCalendar accessible in a setup like mine. Also useful to understand all this was https://www.youtube.com/watch?v=qWSPog9Fz-o