(新的新编辑)
Rustam帮助Arshaw构建了一个很棒的角度模块!一探究竟。使用Angular 7。
https://fullcalendar.io/docs/angular
(新编辑)
我用fullcalendar @alpha版本实现了angluar 5。
我以前遇到了在下面的Angular实施全面的问题。我以为你们也可能想要更新。
如何在没有任何错误的情况下正确实现Angular 5的FullCalendar?我正在尝试将其实现到特定的组件中。我安装了以下软件包
- jQuery
- 时刻
- fullcalendar
- Fullcalendar-Scheduler
fyi,下面的帖子是我最接近找到解决方案的文章。我遵循了指令,但我仍然遇到了" jQueryPromise"错误。请告知&预先感谢!
jQuery事件的回调角函数
package.json
"fullcalendar": "^3.8.0",
"fullcalendar-scheduler": "^1.9.1",
"jquery": "^3.2.1",
"moment": "^2.20.1",
。
"styles": [
"styles.css",
"../node_modules/fullcalendar/dist/fullcalendar.min.css",
"../node_modules/fullcalendar-scheduler/dist/scheduler.min.css"
],
"scripts": [
"../node_modules/jquery/dist/jquery.min.js",
"../node_modules/moment/min/moment.min.js",
"../node_modules/fullcalendar/dist/fullcalendar.min.js",
"../node_modules/fullcalendar-scheduler/dist/scheduler.min.js"
],
main.ts
import * as jQuery from "jquery";
(window as any).$ = (window as any).jQuery = jQuery;
app.component.html
<div id='calendar'></div>
app.component.ts
import { Component } from '@angular/core';
import 'fullcalendar';
import 'fullcalendar-scheduler';
declare let $: any;
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
ngOnInit() {
$('#calendar').fullCalendar({});
}
}
我虔诚地遵循了所有步骤,但我仍然遇到错误。具有讽刺意味
ERROR in node_modules/fullcalendar/dist/fullcalendar.d.ts(695,36): error TS2304: Cannot find name 'JQueryPromise'.
node_modules/fullcalendar/dist/fullcalendar.d.ts(696,29): error TS2304: Cannot find name 'JQueryPromise'.
node_modules/fullcalendar/dist/fullcalendar.d.ts(697,20): error TS2304: Cannot find name 'JQueryPromise'.
node_modules/fullcalendar/dist/fullcalendar.d.ts(759,22): error TS2304: Cannot find name 'JQueryPromise'.
node_modules/fullcalendar/dist/fullcalendar.d.ts(775,50): error TS2304: Cannot find name 'JQueryPromise'.
node_modules/fullcalendar/dist/fullcalendar.d.ts(988,23): error TS2304: Cannot find name 'JQueryEventObject'.
node_modules/fullcalendar/dist/fullcalendar.d.ts(1401,70): error TS2304: Cannot find name 'JQueryAjaxSettings'.
node_modules/fullcalendar/dist/fullcalendar.d.ts(1603,50): error TS2304: Cannot find name 'JQueryPromise'.
node_modules/fullcalendar/dist/fullcalendar.d.ts(1623,50): error TS2304: Cannot find name 'JQueryPromise'.
node_modules/fullcalendar/dist/fullcalendar.d.ts(2588,50): error TS2304: Cannot find name 'JQueryPromise'.
这个兔子洞的新开发项目
刚刚尝试创建一个新的组件" scheed.component"并将所有内容移动到那里,但是现在我会收到以下错误
Refused to load the font 'data:font/woff;base64,d09GRgABAAAAAGVUABEAAAAAxuQAAQABAAAAAAAAAAAAAAAAAAAAAAAAAABHREVGAAABgAAAAC4AAAA0ArgC7UdQT1MAAAGwAAAQ6AAALgxKsqRTR1NVQgAAEpgAAAH3AAAELqI5y+RPUy8yAAAUkAAAAE8AAABgaGyBu2NtYXAAABTgAAABlAAAAkQkRATXY3Z0IAAAFnQAAABeAAAAugDsQf1mcGdtAAAW1AAABZcAAAvNb3/BHGdhc3AAABxsAAAACAAAAAgAAAAQZ2x5ZgAAHHQAAEApAAB3CtbiupxoZWFkAABcoAAAADYAAAA2BkubWWhoZWEAAFzYAAAAIAAAACQHFARfaG10eAAAXPgAAAI6AAAEEk4TN4Nsb2NhAABfNAAAAhIAAAISiLhpam1heHAAAGFIAAAAIAAAACACigzgbmFtZQAAYWgAAACUAAABHhQGLdJwb3N0AABh/AAAAq4AAASRk5y6n3ByZ...QxUajCCFt4p9HP4fzdSWs2XhWl5HvJazrIrFUyB0l5dpqcW10lV2wukjMLuAvyMHNiYpgPsrCVXZDKrkpll6UWkh7kABVAFVCDe7UFmxagDegA+hLHRPbqtMo7ZHCpKdT6tPGXybzo0+RXBLoPZt1tELcXxCmAAyZwYTJvdDFZKnDER44X2451rDqCyunIsRWvLSx6wnWqwPj/uX5/KuEy6DL0z6A/Fn79VihxMFJsrlAFy4DpZOcvNlMeNp+BRDLj0r+XFdRxdSNSNxiI/AL3ojKdAAB4AWPw3sFwIihiIyNjX+QGxp0cDBwMyQUbGdictkUwWDAwsDJogTgOPN4c9iz6bMos4iysHFChUDZXJnMWTSZZJrAQt9M+YQYBBh4GTgY2kEZOoJiA0z4GBxiEiDEzuGxUYewIjNjg0BGxkTnFZaMaiLeLo4GBkcWhIzkkAqQkEggceHw5HFkM2VRZJFlYebR2MP5v3cDSu5GJwWUDW9xG1hQXAFAmKZU=' because it violates the following Content Security Policy directive: "default-src 'self'". Note that 'font-src' was not explicitly set, so 'default-src' is used as a fallback.
由于您提出的GitHub问题,您现在已经解决的问题已经解决了。
我相信运行npm install --save-dev @types/jquery
会在我遇到同样的问题时正确解决此问题,并且运行此问题(在我找到了这篇文章并链接到GitHub问题之后)。
在GitHub上引用修复程序:"现在在文档中说明了这一点:https://fullcalendar.io/docs/typescript/"
,因此在node_modules文件夹中的 *.d.ts文件中似乎有问题。我在GitHub项目中开了一个问题
https://github.com/fullcalendar/fullcalendar/issues/3991
我以"任何"的方式进入了替换的相应问题类型:
node_modules/fullcalendar/dist/fullcalendar.d.ts
node_modules/fullcalendar-scheduler/dist/distuler.d.ts
'jquerypromise'
'jqueryEventObject'
'jqueryajaxsettings'
节日快乐!
您的项目不包含jQuery键入。尝试使用此命令
添加它们npm install --save-dev @types/jquery@3.2.7
在完整日历问题跟踪器(https://github.com/fullcalendar/fullcalendar/3991/3991)上提出了此问题
嗨,我知道这是一个古老的问题,但是此npm install --save-dev @types/jquery
对我不起作用。更快的解决方案是:
- 在
Tools>NuGet Package Manager> Manage NuGet Packages for Solution
上打开解决方案的管理Nuget软件包(软件包管理器的视觉选项) - 在搜索框中写入:
jquery.type
- 查找jquery.typescript.definitypypage
- 在您的Web项目中安装
- 已解决
我希望这可能会帮助那些与我相同的人。