美文网首页
【CKeditor5】datacontroller-init-n

【CKeditor5】datacontroller-init-n

作者: 匿于烟火中 | 来源:发表于2019-04-23 14:36 被阅读0次

使用angular4+和CKeditor5,报错,报错就是提示要创建editor的dom元素不存在

<ckeditor

  #editor

  [editor]="Editor"

  data=""

  [(ngModel)]="data"

  (change)="editorChange($event)"

  >

  </ckeditor>

@ViewChild('editor') editorItem;

this.Editor.create(

      this.editorItem,{

        toolbar: ['imageUpload'],

      }

    ).then((result) => {

      console.log("success",result);

    }).catch((err) => {

      console.log("err",err);

    });

原因是ViewChild获取的editor返回是elementRef

改为这个this.editorItem.elementRef.nativeElement即可以

相关文章

网友评论

      本文标题:【CKeditor5】datacontroller-init-n

      本文链接:https://www.haomeiwen.com/subject/ihuqmqtx.html