import { ModuleWithProviders, NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; import { MyMonacoEditorComponent } from './my-monaco-editor.component'; import { MY_MONACO_EDITOR_CONFIG, MyMonacoEditorConfig } from './editorconfig'; import { CodeEditorEventService } from './my-monaco-editor-services/monaco-editor.event.service'; @NgModule({ imports: [ CommonModule ], exports:[ MyMonacoEditorComponent ], entryComponents:[ MyMonacoEditorComponent ], declarations: [ MyMonacoEditorComponent ], providers:[ CodeEditorEventService ] }) export class MyMonacoEditorModule { public static forRoot(config: MyMonacoEditorConfig = {}): ModuleWithProviders { return { ngModule: MyMonacoEditorModule, providers: [ { provide: MY_MONACO_EDITOR_CONFIG, useValue: config } ] }; } }