Quick Start
Installation
Install via Package managers such as npm or pnpm or yarn
npm install ngx-editor
pnpm install ngx-editor
yarn add ngx-editor
Usage
Import ngx-editor
module
import { NgxEditorModule } from 'ngx-editor';
@NgModule({ imports: [NgxEditorModule],})export class AppModule {}
Initialize editor in the component
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
<ngx-editor [editor]="editor" [ngModel]="html"></ngx-editor>
For ngModel
to work, You must import FormsModule
from @angular/forms