0.0.3 • Published 6 years ago
simplemde-ng-lib v0.0.3
Info
Note: The code of this project originates from https://github.com/doxiaodong/ng2-simplemde. The reason of creating a separate repo is to build and package a healthy angular library and npm package. Therefore the source structure changed reasonably.
Github: https://github.com/Cha-OS/simplemde-ng-lib
Install:
yarn add simplemde-ng-lib
In your code (best in NgModule file) add:
import { SimplemdeModule, SIMPLEMDE_CONFIG } from 'simplemde-ng-lib';
// ...
var simpleMdeOptions: any = {};
// ...
@NgModule({
// ...
imports: [
SimplemdeModule.forRoot({
provide: SIMPLEMDE_CONFIG,
// config options 1
useValue: simpleMdeOptions
})
],
providers: [],
bootstrap: [AppComponent]
})
In component add:
export class AppComponent {
// ...
public simpleMdeOptionsHtml:any = {};
public markdownValue = "Hello ***World***!\n# Idea\n*This* is an idea!";
}
In your template add:
<simplemde [(ngModel)]="markdownValue" [options]="simpleMdeOptionsHtml"></simplemde>
Example of ussage: