ngx-admin/src/app/@core/core.module.ts

31 lines
712 B
TypeScript
Raw Normal View History

import { ModuleWithProviders, NgModule, Optional, SkipSelf } from '@angular/core';
2017-04-13 14:24:23 +03:00
import { CommonModule } from '@angular/common';
import { throwIfAlreadyLoaded } from './module-import-guard';
import { DataModule } from './data/data.module';
const NGA_CORE_PROVIDERS = [
...DataModule.forRoot().providers,
];
2017-04-13 14:24:23 +03:00
@NgModule({
imports: [
2017-05-06 15:35:15 +03:00
CommonModule,
2017-04-13 14:24:23 +03:00
],
2017-05-06 15:35:15 +03:00
declarations: [],
2017-04-13 14:24:23 +03:00
})
export class CoreModule {
constructor(@Optional() @SkipSelf() parentModule: CoreModule) {
throwIfAlreadyLoaded(parentModule, 'CoreModule');
}
static forRoot(): ModuleWithProviders {
return <ModuleWithProviders>{
ngModule: CoreModule,
providers: [
...NGA_CORE_PROVIDERS,
],
};
}
2017-04-13 14:24:23 +03:00
}