diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 519b7698..70294496 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -3,6 +3,7 @@ import { Component, ViewEncapsulation } from '@angular/core'; import { GlobalState } from './global.state'; import { BaImageLoaderService, BaThemePreloader, BaThemeSpinner } from './theme/services'; import { layoutPaths } from './theme/theme.constants'; +import { BaThemeConfig } from './theme/theme.config'; /* * App Component @@ -25,7 +26,8 @@ export class App { constructor(private _state: GlobalState, private _imageLoader: BaImageLoaderService, - private _spinner: BaThemeSpinner) { + private _spinner: BaThemeSpinner, + private _config:BaThemeConfig) { this._loadImages(); diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 575bd4bd..d293c5a4 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -44,7 +44,7 @@ type StoreType = { RouterModule, FormsModule, ReactiveFormsModule, - NgaModule, + NgaModule.forRoot(), PagesModule, routing ], diff --git a/src/app/theme/nga.module.ts b/src/app/theme/nga.module.ts index 3ea13ce7..8155d418 100644 --- a/src/app/theme/nga.module.ts +++ b/src/app/theme/nga.module.ts @@ -1,4 +1,4 @@ -import { NgModule } from '@angular/core'; +import { NgModule, ModuleWithProviders } from '@angular/core'; import { CommonModule } from '@angular/common'; import { ReactiveFormsModule, FormsModule } from '@angular/forms'; import { RouterModule } from '@angular/router'; @@ -106,12 +106,6 @@ const NGA_VALIDATORS = [ FormsModule, ReactiveFormsModule, ], - providers: [ - BaThemeConfigProvider, - BaThemeConfig, - ...NGA_VALIDATORS, - ...NGA_SERVICES - ], exports: [ ...NGA_PIPES, ...NGA_DIRECTIVES, @@ -119,4 +113,15 @@ const NGA_VALIDATORS = [ ] }) export class NgaModule { + static forRoot(): ModuleWithProviders { + return { + ngModule: NgaModule, + providers: [ + BaThemeConfigProvider, + BaThemeConfig, + ...NGA_VALIDATORS, + ...NGA_SERVICES + ], + }; + } }