diff --git a/libs/doc-pages/alerts/src/lib/alerts.module.ts b/libs/doc-pages/alerts/src/lib/alerts.module.ts index 61b8bfe9ae..b706ee6b07 100644 --- a/libs/doc-pages/alerts/src/lib/alerts.module.ts +++ b/libs/doc-pages/alerts/src/lib/alerts.module.ts @@ -15,7 +15,7 @@ export { AlertsSectionComponent } from './alerts-section.component'; ...DEMO_COMPONENTS ], imports: [ - AlertModule.forRoot(), + AlertModule, CommonModule, DocsModule, RouterModule.forChild(routes) diff --git a/libs/doc-pages/alerts/src/lib/docs/usage.md b/libs/doc-pages/alerts/src/lib/docs/usage.md index 9377ee9726..04d714747c 100644 --- a/libs/doc-pages/alerts/src/lib/docs/usage.md +++ b/libs/doc-pages/alerts/src/lib/docs/usage.md @@ -1,6 +1,6 @@ import { AlertModule } from 'ngx-bootstrap/alert'; @NgModule({ - imports: [AlertModule.forRoot(),...] + imports: [AlertModule,...] }) export class AppModule(){} diff --git a/src/alert/alert.component.ts b/src/alert/alert.component.ts index 07885ae597..47b1c92176 100644 --- a/src/alert/alert.component.ts +++ b/src/alert/alert.component.ts @@ -9,11 +9,14 @@ import { } from '@angular/core'; import { AlertConfig } from './alert.config'; import { OnChange } from 'ngx-bootstrap/utils'; +import { NgIf, NgClass } from '@angular/common'; @Component({ - selector: 'alert,bs-alert', - templateUrl: './alert.component.html', - changeDetection: ChangeDetectionStrategy.OnPush + selector: 'alert,bs-alert', + templateUrl: './alert.component.html', + changeDetection: ChangeDetectionStrategy.OnPush, + standalone: true, + imports: [NgIf, NgClass] }) export class AlertComponent implements OnInit { /** Alert type. diff --git a/src/alert/alert.module.ts b/src/alert/alert.module.ts index c43aeb56bf..ce839d9ee8 100644 --- a/src/alert/alert.module.ts +++ b/src/alert/alert.module.ts @@ -1,14 +1,8 @@ -import { CommonModule } from '@angular/common'; -import { NgModule, ModuleWithProviders } from '@angular/core'; +import { NgModule } from '@angular/core'; import { AlertComponent } from './alert.component'; @NgModule({ - imports: [CommonModule], - declarations: [AlertComponent], + imports: [AlertComponent], exports: [AlertComponent] }) -export class AlertModule { - static forRoot(): ModuleWithProviders { - return { ngModule: AlertModule, providers: [] }; - } -} +export class AlertModule {} diff --git a/src/alert/testing/alert.component.spec.ts b/src/alert/testing/alert.component.spec.ts index d589800d6d..e247d4888b 100644 --- a/src/alert/testing/alert.component.spec.ts +++ b/src/alert/testing/alert.component.spec.ts @@ -3,7 +3,10 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { AlertComponent, AlertConfig, AlertModule } from '../index'; -@Component({selector: 'alert-test', template: ''}) +@Component({ + selector: 'alert-test', template: '', + standalone: true +}) class TestAlertComponent extends AlertComponent { constructor(config: AlertConfig, changeDetection: ChangeDetectorRef) { super(config, changeDetection); @@ -25,9 +28,8 @@ describe('Component: Alert', () => { beforeEach(() => { TestBed.configureTestingModule({ - declarations: [TestAlertComponent], - imports: [AlertModule.forRoot()] - }); + imports: [AlertModule, TestAlertComponent] +}); TestBed.overrideComponent(TestAlertComponent, { set: {template: overTemplate} });