/**
 * 进一步对基础模块的导入提炼
 * 有关模块注册指导原则请参考：https://github.com/cipchk/ng-alain/issues/180
 */ import { NgModule , Optional , SkipSelf , ModuleWithProviders , } from '@angular/core' ; import { RouteReuseStrategy } from '@angular/router' ; import { throwIfAlreadyLoaded } from '@core/module-import-guard' ; import { NgZorroAntdModule } from 'ng-zorro-antd' ; import { AlainThemeModule } from '@delon/theme' ; import { DelonABCModule , ReuseTabService , ReuseTabStrategy } from '@delon/abc' ; import { DelonAuthModule } from '@delon/auth' ; import { DelonACLModule } from '@delon/acl' ; import { DelonCacheModule } from '@delon/cache' ; import { DelonUtilModule } from '@delon/util' ; import { DelonMockModule } from '@delon/mock' ; import * as MOCKDATA from '../../_mock' ; import { environment } from '@env/environment' ; const MOCKMODULE = ! environment . production ? [ DelonMockModule . forRoot ( { data : MOCKDATA } ) ] : [ ] ; import { AdPageHeaderConfig } from '@delon/abc' ; export function pageHeaderConfig ( ) { return Object . assign ( new AdPageHeaderConfig ( ) , { home_i18n : 'home' } ) ; } import { DelonAuthConfig } from '@delon/auth' ; export function delonAuthConfig ( ) { return Object . assign ( new DelonAuthConfig ( ) , < DelonAuthConfig > { login_url : '/passport/login' , } ) ; } @ NgModule ( { imports : [ NgZorroAntdModule . forRoot ( ) , AlainThemeModule . forRoot ( ) , DelonABCModule . forRoot ( ) , DelonAuthModule . forRoot ( ) , DelonACLModule . forRoot ( ) , DelonCacheModule . forRoot ( ) , DelonUtilModule . forRoot ( ) , ... MOCKMODULE , ] , } ) export class DelonModule { constructor ( @ Optional ( ) @ SkipSelf ( ) parentModule ) { throwIfAlreadyLoaded ( parentModule , 'DelonModule' ) ; } static forRoot ( ) { return { ngModule : DelonModule , providers : [ { provide : RouteReuseStrategy , useClass : ReuseTabStrategy , deps : [ ReuseTabService ] , } , { provide : AdPageHeaderConfig , useFactory : pageHeaderConfig } , { provide : DelonAuthConfig , useFactory : delonAuthConfig } , ] , } ; } }