diff --git a/libs/doc-pages/collapse/src/lib/collapse.module.ts b/libs/doc-pages/collapse/src/lib/collapse.module.ts index 0608a8280a..3fc120c352 100644 --- a/libs/doc-pages/collapse/src/lib/collapse.module.ts +++ b/libs/doc-pages/collapse/src/lib/collapse.module.ts @@ -17,7 +17,7 @@ export { CollapseSectionComponent } from './collapse-section.component'; ...DEMO_COMPONENTS ], imports: [ - CollapseModule.forRoot(), + CollapseModule, CommonModule, FormsModule, DocsModule, diff --git a/libs/doc-pages/collapse/src/lib/docs/usage.md b/libs/doc-pages/collapse/src/lib/docs/usage.md index 0a93782a8d..1404bfff14 100644 --- a/libs/doc-pages/collapse/src/lib/docs/usage.md +++ b/libs/doc-pages/collapse/src/lib/docs/usage.md @@ -5,7 +5,7 @@ import { CollapseModule } from 'ngx-bootstrap/collapse'; @NgModule({ imports: [ BrowserAnimationsModule, - CollapseModule.forRoot(), + CollapseModule, ... ] }) diff --git a/src/collapse/collapse.directive.ts b/src/collapse/collapse.directive.ts index 9c9ca36a97..c69338234a 100644 --- a/src/collapse/collapse.directive.ts +++ b/src/collapse/collapse.directive.ts @@ -21,12 +21,13 @@ import { } from './collapse-animations'; @Directive({ - selector: '[collapse]', - exportAs: 'bs-collapse', - // eslint-disable-next-line @angular-eslint/no-host-metadata-property - host: { - '[class.collapse]': 'true' - } + selector: '[collapse]', + exportAs: 'bs-collapse', + // eslint-disable-next-line @angular-eslint/no-host-metadata-property + host: { + '[class.collapse]': 'true' + }, + standalone: true }) export class CollapseDirective implements AfterViewChecked { /** This event fires as soon as content collapses */ diff --git a/src/collapse/collapse.module.ts b/src/collapse/collapse.module.ts index 94751fb209..3003a55d79 100644 --- a/src/collapse/collapse.module.ts +++ b/src/collapse/collapse.module.ts @@ -1,13 +1,9 @@ -import { NgModule, ModuleWithProviders } from '@angular/core'; +import { NgModule } from '@angular/core'; import { CollapseDirective } from './collapse.directive'; @NgModule({ - declarations: [CollapseDirective], - exports: [CollapseDirective] + imports: [CollapseDirective], + exports: [CollapseDirective] }) -export class CollapseModule { - static forRoot(): ModuleWithProviders { - return { ngModule: CollapseModule, providers: [] }; - } -} +export class CollapseModule {} diff --git a/src/collapse/testing/collapse.directive.spec.ts b/src/collapse/testing/collapse.directive.spec.ts index 27d0e25ec1..90c42c8d1a 100644 --- a/src/collapse/testing/collapse.directive.spec.ts +++ b/src/collapse/testing/collapse.directive.spec.ts @@ -13,8 +13,10 @@ const template = ` `; @Component({ - selector: 'collapse-test', - template + selector: 'collapse-test', + template, + standalone: true, + imports: [CollapseModule] }) class TestCollapseComponent {} @@ -28,12 +30,12 @@ describe('Directive: Collapse', () => { beforeEach(() => { TestBed.configureTestingModule({ - declarations: [TestCollapseComponent], - imports: [ + imports: [ CollapseModule, - BrowserAnimationsModule - ] - }); + BrowserAnimationsModule, + TestCollapseComponent + ] +}); fixture = TestBed.createComponent(TestCollapseComponent); fixture.detectChanges(); context = fixture.componentInstance;