简体   繁体   中英

How to initialize Full Calendar version 4 in Angular

I'm trying to use the Full Calendar version 4 so I can use mouse over events on events in background mode. For some reason I cannot initialize it in my component(set options), I mean its working when I run ng serve, but I get error on my IDE. I will post the picture error here along with my code. Official docs you can see here https://fullcalendar.io/docs/v4/release-notes

I tried using OptionInputs as a parameter but that didn't work

  import { Component, OnInit } from '@angular/core';
  import { DataService } from './../../shared/services/data.service';
  import 'fullcalendar';
  import { Calendar } from 'fullcalendar';

  @Component({
  selector: 'app-calendar',
  templateUrl: './calendar.component.html',
  styleUrls: ['./calendar.component.css']
  })
 export class CalendarComponent implements OnInit {
 constructor(private dataService: DataService) {}

 myEvents = [];

 transformDate(str: String) {
   return str.substr(0, 10);
 }
  ngOnInit() {
const calendarEl = document.getElementById('calendar');

const calendar = new Calendar(calendarEl, {
  events: [
    {
      title: 'Test A',
      start: '2018-10-09T16:00:00'
    }
  ]
});

calendar.render();

} }

在此处输入图片说明

You are writing the options object in a wrong structure, it requires a plugin property

const calendar = new Calendar(calendarEl, {
  events: [
    {
      title: 'Test A',
      start: '2018-10-09T16:00:00'
    }
  ],
   plugins: []
});

Stackblitz

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM