您好我正在使用我的angular2项目的fullcalendar。但我无法正确显示日历本身。控制台中没有显示错误,但日历和事件不显示。这是它现在显示的
这是我的代码。如果我需要附加更多文件,请告诉我
angular.cli.json
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"project": {
"name": "calendar"
},
"apps": [
{
"root": "src",
"outDir": "dist",
"assets": [
"assets",
"favicon.ico"
],
"index": "index.html",
"main": "main.ts",
"polyfills": "polyfills.ts",
"test": "test.ts",
"tsconfig": "tsconfig.app.json",
"testTsconfig": "tsconfig.spec.json",
"prefix": "app",
"styles": [
"styles.css",
"../node_modules/fullcalendar/dist/fullcalendar.min.css"
],
"scripts": [
"../node_modules/jquery/jquery.js",
"../node_modules/ap-angular2-fullcalendar/angular2-fullcalendar.js",
"../node_modules/moment/moment.js"
],
"environmentSource": "environments/environment.ts",
"environments": {
"dev": "environments/environment.ts",
"prod": "environments/environment.prod.ts"
}
}
],
"e2e": {
"protractor": {
"config": "./protractor.conf.js"
}
},
"lint": [
{
"project": "src/tsconfig.app.json"
},
{
"project": "src/tsconfig.spec.json"
},
{
"project": "e2e/tsconfig.e2e.json"
}
],
"test": {
"karma": {
"config": "./karma.conf.js"
}
},
"defaults": {
"styleExt": "css",
"component": {}
}
}
app.module.ts
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';
import {CalendarComponent} from 'ap-angular2-fullcalendar/src/calendar/calendar'
@NgModule({
declarations: [
AppComponent,
CalendarComponent
],
imports: [
BrowserModule
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
app.component.ts
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
calendarOptions:Object = {
height: 'parent',
fixedWeekCount : false,
defaultDate: '2016-09-12',
editable: true,
eventLimit: true, // allow "more" link when too many events
events: [
{
title: 'All Day Event',
start: '2016-09-01'
},
{
title: 'Long Event',
start: '2016-09-07',
end: '2016-09-10'
},
{
id: 999,
title: 'Repeating Event',
start: '2016-09-09T16:00:00'
},
{
id: 999,
title: 'Repeating Event',
start: '2016-09-16T16:00:00'
},
{
title: 'Conference',
start: '2016-09-11',
end: '2016-09-13'
},
{
title: 'Meeting',
start: '2016-09-12T10:30:00',
end: '2016-09-12T12:30:00'
},
{
title: 'Lunch',
start: '2016-09-12T12:00:00'
},
{
title: 'Meeting',
start: '2016-09-12T14:30:00'
},
{
title: 'Happy Hour',
start: '2016-09-12T17:30:00'
},
{
title: 'Dinner',
start: '2016-09-12T20:00:00'
},
{
title: 'Birthday Party',
start: '2016-09-13T07:00:00'
},
{
title: 'Click for Google',
url: 'http://google.com/',
start: '2016-09-28'
}
]
};
}
app.component.html
<angular2-fullcalendar [options]="calendarOptions"></angular2-fullcalendar>
请帮忙。我被困了。任何帮助都将不胜感激。谢谢
更新1,现在它不仅仅在重新启动机器时工作。控制台说它没有在指定的目录中找到CalendarComponent
通过删除线来解决问题,
高度:“父”
从组件。工作就像一个魅力
我有同样的问题,现在它的工作对我来说,请参考以下信息
你需要包括你的style.css
导入fullcalendar css
如果您正在使用Angular CLI,这就像在style.(scss|css)
文件中包含一行一样简单:
@import "fullcalendar/fullcalendar.min.css";
如果这不起作用,您可以尝试导入fullcalendar。
npm install --save fullcalendar
并包括:
@import "../node_modules/fullcalendar/dist/fullcalendar.min.css";