Skip to content

Quick Start

Installation

Install via Package managers such as npm or pnpm or yarn

Terminal window
npm install ngx-editor

Usage

Import ngx-editor module

app.module.ts
import { NgxEditorModule } from 'ngx-editor';
@NgModule({
imports: [NgxEditorModule],
})
export class AppModule {}

Initialize editor in the component

app.component.ts
import { Editor } from 'ngx-editor';
export class AppComponent implements OnInit, OnDestroy {
html = 'Hello world!';
editor: Editor;
ngOnInit(): void {
this.editor = new Editor();
}
ngOnDestroy(): void {
this.editor.destroy();
}
}

Then in HTML

app.component.html
<ngx-editor [editor]="editor" [ngModel]="html"></ngx-editor>

For ngModel to work, You must import FormsModule from @angular/forms