StickNitro / ngx-fullcalendar

An Angular wrapper for the https://fullcalendar.io module
MIT License
11 stars 14 forks source link

How to Fetch Events from An Api and with error #7

Open tareqkabani opened 5 years ago

StickNitro commented 5 years ago

Could you provide more details of what you need to achieve to help with answering this?

tareqkabani commented 5 years ago

I am trying to find a solution for how to connect with api to fetch events from database

StickNitro commented 5 years ago

Oh ok so you are looking for this documentation from FullCalendar. In a nutshell you can pass in an Array or a JSON feed to the events property or you can access the calendar (and its API) on the component and call the addEvent method

@Component({
  ...
})
export class MyComponent {
  @ViewChild(NgxFullCalendarComponent) fc: FullCalendarComponent;

  ngOnInit() {
    fc.calendar.addEvent({...});
  }
}

The JSON feed should work since the props are simply passed down to the FullCalendar control but I have noticed that it is currently typed to Array<EventObject> so this will need fixing

tareqkabani commented 5 years ago

As you know I started over and over again to solve this problem So I came back to ask you how the data is being called directly from the database by the API    I used this : https://raw.githubusercontent.com/tareqkabani/demo/master/vents.json

StickNitro commented 5 years ago

I would check over this link in the documentation, this component simply wraps the FullCalendar component and exposes its API, if you provide the json feed through events this will get passed through to the FullCalendar.