import { ModuleWithProviders , NgModule } from '@angular/core' ; import { IconModuleOptions } from './icon-options.interface' ; import { ICON_OPTIONS_TOKEN } from './icon-options.token' ; import { IconComponent } from './icon.component' ; import { IconService } from './icon.service' ; @ NgModule ( { declarations : [ IconComponent ] , exports : [ IconComponent ] , providers : [ IconService ] } ) export class IconModule { /** Allow configuration at AppModule level */ static forRoot ( options ? ) { return { ngModule : IconModule , providers : [ { provide : ICON_OPTIONS_TOKEN , useValue : options } ] } ; } /** Allow configuration at a child module level */ static forChild ( options ? ) { return IconModule . forRoot ( options ) ; } }