import { NgModule, InjectionToken, ModuleWithProviders } from '@angular/core'; import { CommonModule } from '@angular/common'; import { FormsModule } from '@angular/forms'; import { EditorComponent, TINYMCE_SCRIPT_SRC } from './editor.component'; import { EditorService } from './editor.service'; // EditorModule.forRoot('/platform/common/web/assets/tinymce/tinymce.min.js'), @NgModule({ declarations: [EditorComponent], imports: [ CommonModule, FormsModule ], exports: [EditorComponent], providers:[ EditorService ] }) export class EditorModule { static forRoot(path: string): ModuleWithProviders { return { ngModule: EditorModule, providers: [ {provide: TINYMCE_SCRIPT_SRC, useValue: path} ] } } }