完整日历的正文未在加载时显示

时间:2019-08-19 13:16:29

标签: fullcalendar angular7 fullcalendar-4

我正在尝试在ngx bootstrap选项卡中显示全日历模块,但是在开始时,单击标题按钮后,我只得到标题,它显示了所有日历

我尝试在ngOnInit中移动分配,但没有成功

import {AfterViewInit, Component, OnInit} from '@angular/core';
import dayGridPlugin from "@fullcalendar/daygrid";

@Component({
  selector: 'app-calendar-module',
  templateUrl: './calendar-module.component.html',
  styleUrls: ['./calendar-module.component.scss']
})
export class CalendarModuleComponent implements OnInit, AfterViewInit {
  public calendarPlugins = [dayGridPlugin];
  constructor() { }

  ngOnInit() {

  }

  ngAfterViewInit(){

  }
}
<full-calendar
  defaultView="dayGridMonth"
  [plugins]="calendarPlugins"
  [weekends]="false"
  [events]="[
    { title: 'event 1', start:'2019-08-19', end:'2019-08-30', color:'red' }
  ]"
></full-calendar>

Link to screenshot

1 个答案:

答案 0 :(得分:1)

这有效

ngOnInit() {
       setTimeout(() => {
           this.calendarComponent.getApi().render();
       }, 300);
   }