mirror of
https://github.com/akveo/ngx-admin.git
synced 2025-12-18 08:20:13 +01:00
refactor(app): refactor forRoot & menu import
This commit is contained in:
parent
d6cef06dcd
commit
be69ccc058
6 changed files with 170 additions and 111 deletions
|
|
@ -1,7 +1,12 @@
|
|||
import { NgModule, Optional, SkipSelf } from '@angular/core';
|
||||
import { ModuleWithProviders, NgModule, Optional, SkipSelf } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
|
||||
import { throwIfAlreadyLoaded } from './module-import-guard';
|
||||
import { DataModule } from './data/data.module';
|
||||
|
||||
const NGA_CORE_PROVIDERS = [
|
||||
...DataModule.forRoot().providers,
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
|
|
@ -13,4 +18,13 @@ export class CoreModule {
|
|||
constructor(@Optional() @SkipSelf() parentModule: CoreModule) {
|
||||
throwIfAlreadyLoaded(parentModule, 'CoreModule');
|
||||
}
|
||||
|
||||
static forRoot(): ModuleWithProviders {
|
||||
return <ModuleWithProviders>{
|
||||
ngModule: CoreModule,
|
||||
providers: [
|
||||
...NGA_CORE_PROVIDERS,
|
||||
],
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue