Skip to content

Commit 72eb356

Browse files
committed
fix(collapse): add toggle AfterViewInit, spelling
1 parent c9e85f6 commit 72eb356

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

projects/coreui-angular/src/lib/accordion/accordion-item/accordion-item.component.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ export class AccordionItemComponent implements OnInit, OnDestroy, AfterContentIn
7272
}
7373

7474
toggleItem(): void {
75-
this.accordionService.toggelItem(this);
75+
this.accordionService.toggleItem(this);
7676
}
7777

7878
ngAfterContentInit(): void {

projects/coreui-angular/src/lib/accordion/accordion.service.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export class AccordionService {
2020
}
2121
}
2222

23-
toggelItem(item: AccordionItemComponent): void {
23+
toggleItem(item: AccordionItemComponent): void {
2424
item.visible = !item.visible;
2525
this.closeOtherItems(item);
2626
}

projects/coreui-angular/src/lib/collapse/collapse.directive.ts

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import {
2+
AfterViewInit,
23
Directive,
34
DoCheck,
45
ElementRef,
@@ -22,7 +23,7 @@ import { BooleanInput, coerceBooleanProperty } from '@angular/cdk/coercion';
2223
selector: '[cCollapse]',
2324
exportAs: 'cCollapse'
2425
})
25-
export class CollapseDirective implements OnChanges, OnDestroy, DoCheck {
26+
export class CollapseDirective implements OnChanges, OnDestroy, DoCheck, AfterViewInit {
2627

2728
static ngAcceptInputType_navbar: BooleanInput;
2829

@@ -92,7 +93,7 @@ export class CollapseDirective implements OnChanges, OnDestroy, DoCheck {
9293
get hostClasses(): any {
9394
return {
9495
'navbar-collapse': this.navbar,
95-
show: this.visible,
96+
show: this.visible
9697
};
9798
}
9899

@@ -145,4 +146,8 @@ export class CollapseDirective implements OnChanges, OnDestroy, DoCheck {
145146
this.player.onStart(() => {this.collapseChange.emit(visible ? 'opening' : 'collapsing'); });
146147
this.player.onDone(() => {this.collapseChange.emit(visible ? 'open' : 'collapsed'); });
147148
}
149+
150+
ngAfterViewInit(): void {
151+
this.toggle();
152+
}
148153
}

0 commit comments

Comments
 (0)