Skip to content

Instantly share code, notes, and snippets.

@buildmotion
Created February 1, 2018 06:54
Show Gist options
  • Save buildmotion/73969851a7dd6cdbe79596581e71428f to your computer and use it in GitHub Desktop.
Save buildmotion/73969851a7dd6cdbe79596581e71428f to your computer and use it in GitHub Desktop.
App.CoreModule.ts
import {
ModuleWithProviders,
NgModule,
Optional,
SkipSelf
} from '@angular/core';
import { CommonModule } from '@angular/common';
import { MarkdownEditorModule } from './../markdown-editor/markdown-editor.module';
import { MarkdownEditorOptions } from './../markdown-editor/markdownEditorOptions';
const editorConfig = new MarkdownEditorOptions();
editorConfig.autoDownloadFontAwesome = true;
editorConfig.initialValue = 'Hello Editor...write something amazing.';
@NgModule({
imports: [
MarkdownEditorModule.forRoot(editorConfig)
],
declarations: [
],
exports: [ ],
providers: [ ]
})
export class CoreModule {
/**
* Use the check to determine if the [CoreModule] has been loaded in the parentModule (AppModule root).
*/
constructor( @Optional() @SkipSelf() parentModule: CoreModule) {
if (parentModule) {
throw new Error(`CoreModule is already loaded. Import it in the AppModule only.`);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment