Skip to content

Commit

Permalink
fix(accordion): initialize destroyOnHide from configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
maxokorokov committed Oct 5, 2023
1 parent 445ba02 commit a8b39be
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/accordion/accordion-config.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ describe('ngb-accordion-config', () => {
const config = new NgbAccordionConfig(new NgbConfig());

expect(config.closeOthers).toBe(false);
expect(config.destroyOnHide).toBe(true);
expect(config.type).toBeUndefined();
});
});
2 changes: 2 additions & 0 deletions src/accordion/accordion-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import { NgbConfig } from '../ngb-config';
@Injectable({ providedIn: 'root' })
export class NgbAccordionConfig {
closeOthers = false;
destroyOnHide = true;

/**
* @deprecated 14.1.0
*/
Expand Down
3 changes: 2 additions & 1 deletion src/accordion/accordion.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ export class NgbAccordionDirective {
*
* This property can be overwritten at the [`NgbAccordionItem`](#/components/accordion/api#NgbAccordionItem) level
*/
@Input() destroyOnHide = true;
@Input() destroyOnHide: boolean;

/**
* Event emitted before expanding animation starts. The payload is the id of shown accordion item.
Expand Down Expand Up @@ -416,6 +416,7 @@ export class NgbAccordionDirective {
constructor(config: NgbAccordionConfig) {
this.animation = config.animation;
this.closeOthers = config.closeOthers;
this.destroyOnHide = config.destroyOnHide;
}

/**
Expand Down

0 comments on commit a8b39be

Please sign in to comment.