[英]How to get value from entered in ckeditor using ngModel in angular 8?
<ckeditor [(ngModel)]="editorData" [editor]="Editor"></ckeditor>
How can i get the value of text inputted from ckeditor using ngmodel from html to component.如何使用 ngmodel 从 html 到组件获取从 ckeditor 输入的文本的值。 I am using angular 8 and ckeditor 5
我正在使用 angular 8 和 ckeditor 5
With ngModel
使用
ngModel
You'll already have the data in your component with 2-way binding.您的组件中已经拥有具有 2 向绑定的数据。 So the
editorData
property will have the most up-to-date value.因此
editorData
属性将具有最新值。
ckeditor ngModel ckeditor ngModel
With change
event随着
change
事件
You can use the (change)
event from the editor.您可以使用编辑器中的
(change)
事件。
<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 );
}
...
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.