添加链接
link之家
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
相关文章推荐
想发财的苹果  ·  Spring ...·  8 月前    · 
开朗的路灯  ·  idea的Tomcat的jmx ...·  1 年前    · 
Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

I'm trying to use fullcalendar with angular .

Even though valid events are added to my events field, they don't show up in the UI. Hard coded events are shown. As I'm quite new to angular, so the error might not be related to fullcalendar.

export class CalendarComponent {
  constructor() {}
  events: EventInput[] = [];
  calendarOptions: CalendarOptions = {   
    events: this.events,
    initialView: 'timeGridWeek',
    initialDate: Date.now(),
    locale: 'de',
    nowIndicator: true,
    themeSystem: 'bootstrap',
  async onAddEvent() {
    const modalRef = this.modalService.open(NewEventComponent);
    const newShift: Shift = await modalRef.result;
    if (!newShift) return;
    this.events.push(newShift);

This is the according .html

<full-calendar #calendar [options]="calendarOptions"></full-calendar>

I figured out that resetting events and calendarOptions.events does work, is it possible that angular does not recognise the change? What is the correct way? (see below)

 this.events = [newShift];
 this.calendarOptions.events = this.events;
        

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.