import { Component, OnInit, ViewChild } from '@angular/core'; import { CalendarComponent } from 'ng-fullcalendar'; import { Options } from 'fullcalendar'; import { EventSesrvice } from './event.service'; interface User { name: string; } @Component({ selector: 'demo-app', templateUrl: './app.component.html' }) export class AppComponent implements OnInit { calendarOptions: Options; displayEvent: any; @ViewChild(CalendarComponent) ucCalendar: CalendarComponent; constructor(protected eventService: EventSesrvice) { } ngOnInit() { this.eventService.getEvents().subscribe(data => { this.calendarOptions = { editable: true, eventLimit: false, header: { left: 'prev,next today', center: 'title', right: 'month,agendaWeek,agendaDay,listMonth' }, events: data }; }); } clickButton(model: any) { this.displayEvent = model; } eventClick(model: any) { model = { event: { id: model.event.id, start: model.event.start, end: model.event.end, title: model.event.title, allDay: model.event.allDay // other params }, duration: {} } this.displayEvent = model; } updateEvent(model: any) { model = { event: { id: model.event.id, start: model.event.start, end: model.event.end, title: model.event.title // other params }, duration: { _data: model.duration._data } } this.displayEvent = model; } windowResize(model: any) { console.log('The calendar has adjusted to a window resize'); } viewRender(model: any) { console.log('viewRender'); } }