Created
February 1, 2018 06:54
-
-
Save buildmotion/73969851a7dd6cdbe79596581e71428f to your computer and use it in GitHub Desktop.
App.CoreModule.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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