Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JS error when calendar being destroyed in Angular, with custom content-injection #7105

Closed
1 task done
arshaw opened this issue Dec 22, 2022 · 4 comments
Closed
1 task done

Comments

@arshaw
Copy link
Member

arshaw commented Dec 22, 2022

Reduced Test Case

https://stackblitz.com/edit/github-msefaz?file=src%2Fapp%2Fmy-calendar%2Fmy-calendar.component.html

Do you understand that if a reduced test case is not provided, we will intentionally delay triaging of your ticket?

  • I understand

Which connector are you using (React/Angular/etc)?

Angular

Bug Description

Reported by @hoangdinhcong in #7058 (comment)

With Angular, when using eventContent, and when the calendar is torn down, a JS error occurs.

@arshaw
Copy link
Member Author

arshaw commented Dec 27, 2022

Fixed in v6.0.2

Updated repro without errors:
https://stackblitz.com/edit/github-msefaz-k9zngw?file=src%2Fapp%2Fapp.component.ts,package.json

@arshaw arshaw closed this as completed Dec 27, 2022
@hoangdinhcong
Copy link

thank you @arshaw. Works like a charm 🚀

@joelcoxokc
Copy link

@arshaw This just started happening for me.
Same exact error from #7058

However, I am not using eventContent.
I am using v6.1.4 on angular 15

@joelcoxokc
Copy link

joelcoxokc commented Mar 16, 2023

@arshaw

Ive edited this message to say this.
"Another strange note, this happens on initialization of the component, not during destroy".

I was able to fix the issue, by adding a boolean called init and wrapping the calendar in an ngIf.
I then toggle the boolean in my ngOnInit()

    <ng-container *ngIf="init">
        <full-calendar
            #calendar
            [options]="calendarOptions"
            [events]="data$ | async"></full-calendar>
    </ng-container>
public ngOnInit(): void {
    this.init = true;
}

Here is my calendar options

protected calendarOptions: CalendarOptions = {
    initialView: 'dayGridMonth',
    headerToolbar: false,
    locale: 'en',
    plugins: [dayGridPlugin, interactionPlugin],
    eventClick: (info) => this.handleEventClick(info),
    datesSet: (arg) => this.handleDateSet(arg),
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants