Skip to content

Commit f40328a

Browse files
author
mmart1n
committed
fix(accordion): call detectChanges on accordion
1 parent 526fd48 commit f40328a

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

projects/igniteui-angular/src/lib/accordion/accordion.component.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { AfterContentInit, AfterViewInit, Component, ContentChildren, EventEmitter,
1+
import { AfterContentInit, AfterViewInit, ChangeDetectorRef, Component, ContentChildren, EventEmitter,
22
HostBinding, Input, OnDestroy, Output, QueryList } from '@angular/core';
33
import { fromEvent, Subject } from 'rxjs';
44
import { takeUntil } from 'rxjs/operators';
@@ -211,7 +211,7 @@ export class IgxAccordionComponent implements AfterContentInit, AfterViewInit, O
211211
private _enabledPanels!: IgxExpansionPanelComponent[];
212212
private _singleBranchExpand = false;
213213

214-
constructor() { }
214+
constructor(private cdr: ChangeDetectorRef) { }
215215

216216
/** @hidden @internal **/
217217
public ngAfterContentInit(): void {
@@ -274,9 +274,9 @@ export class IgxAccordionComponent implements AfterContentInit, AfterViewInit, O
274274
this.panels?.forEach((p: IgxExpansionPanelComponent) => {
275275
if (p !== lastExpanded && !p.header.disabled) {
276276
p.collapsed = true;
277-
p.cdr.detectChanges();
278277
}
279278
});
279+
this.cdr.detectChanges();
280280
}
281281

282282
private handleKeydown(event: KeyboardEvent, panel: IgxExpansionPanelComponent): void {

projects/igniteui-angular/src/lib/expansion-panel/expansion-panel.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ export class IgxExpansionPanelComponent extends ToggleAnimationPlayer implements
199199

200200
private _collapsed = true;
201201

202-
constructor(public cdr: ChangeDetectorRef, protected builder: AnimationBuilder, private elementRef?: ElementRef) {
202+
constructor(private cdr: ChangeDetectorRef, protected builder: AnimationBuilder, private elementRef?: ElementRef) {
203203
super(builder);
204204
}
205205

0 commit comments

Comments
 (0)