Reputation: 3192
Hello i am using fullcalendar with my angular2 project.But i am not able to properly display the calendar itself.There is no error shown in the console but the calendar and events doesnt display. this is what it is displaying as of now
Here are my codes.Please let me know if i need to attach any more files
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>
Please help.I am stuck.Any help would be appreciated.Thank you
Update 1,Now it is not working only on restarting the machine.The console says its not finding CalendarComponent in the specified directory
Upvotes: 2
Views: 2409
Reputation: 5325
I have same problem, now its work for me, please refer following information
You need to include your style.css
to
import the fullcalendar css
If you're using Angular CLI, this is as simple as including one line in your style.(scss|css)
file:
@import "fullcalendar/fullcalendar.min.css";
If this does not work you can try by importing fullcalendar.
npm install --save fullcalendar
and include:
@import "../node_modules/fullcalendar/dist/fullcalendar.min.css";
Upvotes: 0
Reputation: 3192
Solved the issue by removing the line,
height:'parent'
from the component.Worked like a charm
Upvotes: 2