Skip to content

Commit

Permalink
fix(collapse): add toggle AfterViewInit, spelling
Browse files Browse the repository at this point in the history
  • Loading branch information
xidedix committed Mar 8, 2022
1 parent c9e85f6 commit 72eb356
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export class AccordionItemComponent implements OnInit, OnDestroy, AfterContentIn
}

toggleItem(): void {
this.accordionService.toggelItem(this);
this.accordionService.toggleItem(this);
}

ngAfterContentInit(): void {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export class AccordionService {
}
}

toggelItem(item: AccordionItemComponent): void {
toggleItem(item: AccordionItemComponent): void {
item.visible = !item.visible;
this.closeOtherItems(item);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {
AfterViewInit,
Directive,
DoCheck,
ElementRef,
Expand All @@ -22,7 +23,7 @@ import { BooleanInput, coerceBooleanProperty } from '@angular/cdk/coercion';
selector: '[cCollapse]',
exportAs: 'cCollapse'
})
export class CollapseDirective implements OnChanges, OnDestroy, DoCheck {
export class CollapseDirective implements OnChanges, OnDestroy, DoCheck, AfterViewInit {

static ngAcceptInputType_navbar: BooleanInput;

Expand Down Expand Up @@ -92,7 +93,7 @@ export class CollapseDirective implements OnChanges, OnDestroy, DoCheck {
get hostClasses(): any {
return {
'navbar-collapse': this.navbar,
show: this.visible,
show: this.visible
};
}

Expand Down Expand Up @@ -145,4 +146,8 @@ export class CollapseDirective implements OnChanges, OnDestroy, DoCheck {
this.player.onStart(() => {this.collapseChange.emit(visible ? 'opening' : 'collapsing'); });
this.player.onDone(() => {this.collapseChange.emit(visible ? 'open' : 'collapsed'); });
}

ngAfterViewInit(): void {
this.toggle();
}
}

0 comments on commit 72eb356

Please sign in to comment.