简体   繁体   中英

Angular7 FullCalendar error: Cannot read property 'length' of undefined

I am trying out FullCalendar version 4.3 on a clean Angular 7.2.0 application. I am following this official guide . When I load a simple empty calendar, it works fine. As soon as I add any events AND the event should be displayed, it throws an error without displaying the event.

full calendar with events (copied from documentation):

<full-calendar
  defaultView="dayGridMonth"
  [plugins]="calendarPlugins"
  [weekends]="false"
  [events]="[
    { title: 'event 1', date: '2019-08-06' },
    { title: 'event 2', date: '2019-08-07' }
  ]"
></full-calendar>

Error:

ERROR TypeError: Cannot read property 'length' of undefined
    at DayGridView.push../node_modules/@fullcalendar/core/main.esm.js.View.computeEventDraggable (main.esm.js:7575)
    at DayGridEventRenderer.push../node_modules/@fullcalendar/daygrid/main.esm.js.SimpleDayGridEventRenderer.renderSegHtml (main.esm.js:218)
    at DayGridEventRenderer.push../node_modules/@fullcalendar/core/main.esm.js.FgEventRenderer.renderSegEls (main.esm.js:7799)
    at DayGridEventRenderer.push../node_modules/@fullcalendar/core/main.esm.js.FgEventRenderer.renderSegs (main.esm.js:7763)
    at DayGrid.res [as renderFgEvents] (main.esm.js:3183)
    at DayGrid.push../node_modules/@fullcalendar/daygrid/main.esm.js.DayGrid.render (main.esm.js:742)
    at DayGrid.push../node_modules/@fullcalendar/core/main.esm.js.Component.receiveProps (main.esm.js:3881)
    at SimpleDayGrid.push../node_modules/@fullcalendar/daygrid/main.esm.js.SimpleDayGrid.render (main.esm.js:1518)
    at SimpleDayGrid.push../node_modules/@fullcalendar/core/main.esm.js.Component.receiveProps (main.esm.js:3881)
    at DayGridView.push../node_modules/@fullcalendar/daygrid/main.esm.js.DayGridView.render (main.esm.js:1584)

I found this example angular project on github which works fine. I recreated the project from scatch, updating the FullCalendar version to 4.3.0 (latest) without any problems. I can't figure out what went wrong in the original app, however if anyone's having trouble getting it to work, the example project will help.

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