diff --git a/src/app/components/accordion/accordion.ts b/src/app/components/accordion/accordion.ts index 9b829050245..21e63bac98a 100644 --- a/src/app/components/accordion/accordion.ts +++ b/src/app/components/accordion/accordion.ts @@ -74,7 +74,9 @@ export class AccordionTab implements OnDestroy { } set animating(val: boolean) { this._animating = val; - this.changeDetector.detectChanges(); + + if (!this.isDestroyed) + this.changeDetector.detectChanges(); } contentTemplate: TemplateRef; @@ -85,6 +87,8 @@ export class AccordionTab implements OnDestroy { accordion: Accordion; + isDestroyed: boolean = false; + constructor(@Inject(forwardRef(() => Accordion)) accordion, public changeDetector: ChangeDetectorRef) { this.accordion = accordion as Accordion; } @@ -161,6 +165,7 @@ export class AccordionTab implements OnDestroy { ngOnDestroy() { this.accordion.tabs.splice(this.findTabIndex(), 1); + this.isDestroyed = true; } }