search envelope-o feed check
Home Unanswered Active Tags New Question
user comment-o

Angular4 Calendar not showing new events

Asked by Iñigo
7 years ago.

Hi!
I'm trying your Angular4 tutorial for the javascript calendar and I have a problem. When I add new events on the calendar, the top modal shows, I enter a title and hit create. The modal closes and nothing shows on the calendar.

Watching the network tab on the developer console I see the call to the api and if I refresh the page the event shows up.

I can't figure how to fix this, I'm kind of new on Angular2.

I'm trying to build this demo because we are thinking on buying it. Any help would be appreciated,

Thanks!

Answer posted by Iñigo
7 years ago.

Hi! I answer my own question. In the calendar.component.ts, on the createdClosed function there is an error:

createClosed(args) {
    /*
    This function gets called twice, first args is undefined, the second one it gets the event object itself
    if (args && args.result) {
      this.events.push(args.result);
    }
    */
    // So it should be pushed itself
    if (args) {
      this.events.push(args);
    }
    this.calendar.control.clearSelection();
  }

Thanks anyway and I hope this answer helps :) It is a great piece of software and I really am looking forward to work with it.

Comment posted by Dan Letecky [DayPilot]
7 years ago.

It turns out there is a bug in calendar.component.ts. It's necessary to replace the createClosed() method with this one:

  createClosed(result) {
    if (result) {
      this.events.push(result);
    }
    this.calendar.control.clearSelection();
  }

The tutorial download will be updated shortly.

Let me know if there is any problem. And thanks for reporting the issue!

Comment posted by Dan Letecky [DayPilot]
7 years ago.

Oh - I can see that you have already found the problem. Thanks for posting the fix!

This question is more than 1 months old and has been closed. Please create a new question if you have anything to add.