fullcalendar / fullcalendar-angular

The official Angular component for FullCalendar
https://fullcalendar.io/docs/angular
MIT License
1.08k stars 176 forks source link

v6 example project error "The selector "app-root" did not match any elements" #417

Closed ganySA closed 1 year ago

ganySA commented 2 years ago

Example project does not work: https://codesandbox.io/s/github/fullcalendar/fullcalendar-example-projects/tree/v6/angular

Wanted to log a related bug with sandbox but cant seem to get it working. Accessing the fullcalendar API does not seem to work when using the following:

In my project:

export class AppComponent {

  // references the #calendar in the template
  @ViewChild('calendar') calendarRef: ElementRef<FullCalendarElement>;

  calendarOptions: CalendarOptions = {
    plugins: [dayGridPlugin],
  };

  someMethod() {
    let calendarApi = this.calendarRef.nativeElement.getApi();  **<-- this line is null in my code in ViewAfterInit() method.**
    calendarApi.next();
  }
}
acerix commented 2 years ago

I can confirm the example is not workign. It seems like a problem with the selector in @Component({ selector:, it works using <body> instead:

https://codesandbox.io/s/frosty-bhabha-0xjvpr?file=/src/index.html

arshaw commented 1 year ago

Codesandbox isn't working very well for Angular projects lately. I've updated all the code samples on this page to use Stackblitz instead:

https://fullcalendar.io/reduced-test-cases

That should work.