import { NgModule , ModuleWithProviders } from '@angular/core' ; import { CommonModule } from '@angular/common' ; import { MonacoEditorDirective } from './directives/monaco-editor/monaco-editor.directive' ; import { MonacoEditorService } from './services/monaco-editor.service' ; import { MONACO_EDITOR_OPTIONS } from './tokens/editor-options.token' ; import { MonacoEditorOptions } from './entities/editor-options' ; @ NgModule ( { imports : [ CommonModule ] , declarations : [ MonacoEditorDirective ] , exports : [ MonacoEditorDirective ] } ) export class MonacoEditorModule { static forRoot ( config = { } ) { return { ngModule : MonacoEditorModule , providers : [ MonacoEditorService , { provide : MONACO_EDITOR_OPTIONS , useValue : config . options || { } } ] } ; } }