Skip to content

Commit

Permalink
fix(accordion): Fixed changed after check error on dynamic panels
Browse files Browse the repository at this point in the history
Closes #158
  • Loading branch information
edcarroll committed Jul 4, 2017
1 parent 9bb3e5c commit d116b6a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/modules/accordion/components/accordion-panel.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, Input, Output, EventEmitter } from "@angular/core";
import { Component, Input, Output, EventEmitter, ChangeDetectorRef } from "@angular/core";
import { SuiAccordionService } from "../services/accordion.service";
import { TransitionController, Transition } from "../../transition";

Expand Down Expand Up @@ -36,6 +36,7 @@ export class SuiAccordionPanel {

public set service(service:SuiAccordionService) {
this._service = service;
this._changeDetector.detectChanges();
}

@Input()
Expand Down Expand Up @@ -88,7 +89,7 @@ export class SuiAccordionPanel {
@Output()
public isOpenChange:EventEmitter<boolean>;

constructor() {
constructor(private _changeDetector:ChangeDetectorRef) {
this.transitionController = new TransitionController(false);

this._isOpen = false;
Expand Down
2 changes: 1 addition & 1 deletion src/modules/accordion/components/accordion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export class SuiAccordion implements AfterContentInit {
this.updatePanels();

// Reconnect panels after they have updated.
this._panels.changes.subscribe(() => setTimeout(() => this.updatePanels()));
this._panels.changes.subscribe(() => this.updatePanels());
}

public updatePanels():void {
Expand Down

0 comments on commit d116b6a

Please sign in to comment.