Reputation: 3
<ckeditor [(ngModel)]="editorData" [editor]="Editor"></ckeditor>
How can i get the value of text inputted from ckeditor using ngmodel from html to component. I am using angular 8 and ckeditor 5
Upvotes: 0
Views: 4355
Reputation: 6529
With ngModel
You'll already have the data in your component with 2-way binding. So the editorData
property will have the most up-to-date value.
With change
event
You can use the (change)
event from the editor.
<ckeditor [editor]="Editor" (change)="onChange($event)"></ckeditor>
import { ChangeEvent } from '@ckeditor/ckeditor5-angular/ckeditor.component';
@Component( {
// ...
} )
export class MyComponent {
public onChange( { editor }: ChangeEvent ) {
const data = editor.getData();
console.log( data );
}
...
}
Upvotes: 2