最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

angular19 - Angular 19 FullCalendar - Populate Events From Angular Service - Stack Overflow

programmeradmin1浏览0评论

Good day. I'm playing around with an Angular 19 application which is taken straight from FullCalendar's GitHub repo. As expected, the initializeEvents from a hard-coded array in the demo works just fine. I need to populate the events, though, from a URL. I have tried converting the service call response to EventAPI, EventInput etc... but even though I can plainly see the service call response being constructed into an array, the calendar seems to be oblivious to it. If anyone can give me some guidance here, it would be greatly appreciated.

Here is my options object in my app-component:

   

export class AppComponent {
      calendarVisible = signal(true);
      calendarOptions = signal<CalendarOptions>({
        plugins: [
          interactionPlugin,
          dayGridPlugin,
          timeGridPlugin,
          listPlugin,
        ],
        headerToolbar: {
          left: 'prev,next today',
          center: 'title',
          right: 'dayGridMonth,timeGridWeek,timeGridDay,listWeek'
        },
        initialView: 'dayGridMonth',
        //initialEvents: INITIAL_EVENTS, // alternatively, use the `events` setting to                fetch from a feed
        weekends: true,
        editable: true,
        selectable: true,
        selectMirror: true,
        dayMaxEvents: true,
        select: this.handleDateSelect.bind(this),
        eventClick: this.handleEventClick.bind(this),
        eventsSet: this.handleEvents.bind(this),
        /* you can update a remote database when these fire:
        eventAdd:
        eventChange:
        eventRemove:
        */
       events: this.loadEvents.bind(this)
      });
     

      constructor(private changeDetector: ChangeDetectorRef) {
      }

    ...
    }
发布评论

评论列表(0)

  1. 暂无评论