我正在尝试在Angular 2中实现FullCalendar Scheduler,并且我遵循了以下指定的步骤 -
安装所需的依赖性如下 -
"dependencies": {
"fullcalendar": "^3.8.0",
"fullcalendar-scheduler": "^1.9.1",
"jquery": "^3.2.1",
"moment": "^2.20.1"
},
"devDependencies": {
"@types/jquery": "^2.0.47"
}
更新了angular-cli.json
如下 -
"styles": [
"styles.css",
"../node_modules/bootstrap/dist/css/bootstrap.min.css",
"../node_modules/fullcalendar/dist/fullcalendar.min.css",
"../node_modules/fullcalendar-scheduler/dist/scheduler.min.css",
"../node_modules/primeng/resources/primeng.min.css",
"../node_modules/primeng/resources/themes/omega/theme.css",
"../node_modules/font-awesome/css/font-awesome.min.css"
],
"scripts": ["../node_modules/jquery/dist/jquery.js",
"../node_modules/moment/min/moment.min.js",
"../node_modules/fullcalendar/dist/fullcalendar.js",
"../node_modules/fullcalendar-scheduler/dist/scheduler.min.js"
],
我已经在qazxsw poi和qazxsw poi中导入了依赖项 -
main.ts -
main.ts
app.component.html -
module.ts
app.component.ts
import * as jQuery from "jquery";
(window as any).$ = (window as any).jQuery = jQuery;
我已经解决了jQuery错误中指定的@type / jquery问题,但是我无法编译下面提到的代码错误 -
<div id='calendar'></div>
请找到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 /Users/jeet/Documents/Development/frontend/node_modules/fullcalendar/dist/fullcalendar.d.ts (347,6): Type 'string' is not assignable to type 'EmitterInterface[]'.
ERROR in /Users/jeet/Documents/Development/frontend/node_modules/fullcalendar/dist/fullcalendar.d.ts (124,27): ']' expected.
ERROR in /Users/jeet/Documents/Development/frontend/node_modules/fullcalendar/dist/fullcalendar.d.ts (125,28): ']' expected.
ERROR in /Users/jeet/Documents/Development/frontend/node_modules/fullcalendar/dist/fullcalendar.d.ts (125,33): ';' expected.
ERROR in /Users/jeet/Documents/Development/frontend/node_modules/fullcalendar/dist/fullcalendar.d.ts (126,28): ']' expected.
ERROR in /Users/jeet/Documents/Development/frontend/node_modules/fullcalendar/dist/fullcalendar.d.ts (126,33): ';' expected.
full error here
我请求你的帮助。
这应该适合你。你也可以在这里查看git repo https://github.com/fullcalendar/fullcalendar/issues/3991
app.component.ts
fullcalendar & Angular 5
角cli.json:
https://gitlab.com/haque.mdmanzurul/ng-fullcalendar
的package.json
import * as jQuery from 'jquery';
(window as any).jQuery = (window as any).$ = jQuery; // This is needed to resolve issue.
import { Component, OnInit } from '@angular/core';
import 'fullcalendar';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent implements OnInit {
title = 'My Calendar';
ngOnInit() {
$('#calendar').fullCalendar({});
}
}