Skip to content

Commit

Permalink
Fixed #4610
Browse files Browse the repository at this point in the history
  • Loading branch information
Çağatay Çivici committed Dec 24, 2017
1 parent b3676f8 commit a3a1369
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/app/components/accordion/accordion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ export class Accordion implements BlockableUI, AfterContentInit, OnDestroy {

initTabs(): any {
this.tabs = this.tabList.toArray();
this.updateSelectionState();
}

getBlockableElement(): HTMLElement {
Expand All @@ -170,16 +171,19 @@ export class Accordion implements BlockableUI, AfterContentInit, OnDestroy {

set activeIndex(val: any) {
this._activeIndex = val;

if(this.tabs && this.tabs.length && this._activeIndex != null) {
for(let i = 0; i < this.tabs.length; i++) {
this.updateSelectionState();
}

updateSelectionState() {
if (this.tabs && this.tabs.length && this._activeIndex != null) {
for (let i = 0; i < this.tabs.length; i++) {
let selected = this.multiple ? this._activeIndex.includes(i) : (i === this._activeIndex);
let changed = selected !== this.tabs[i].selected;
if(changed) {

if (changed) {
this.tabs[i].animating = true;
}

this.tabs[i].selected = selected;
this.tabs[i].selectedChange.emit(selected);
}
Expand Down

0 comments on commit a3a1369

Please sign in to comment.