【问题标题】:Angular 2 update CKEditor textareaAngular 2 更新 CKEditor 文本区域
【发布时间】:2016-10-23 16:15:37
【问题描述】:

Plunker:https://plnkr.co/edit/aUBtpe?p=preview

使用 CKEditor,content 变量不会更新为 textarea 值更改。它与从服务器接收到的原始 page.content 变量保持相同。

console.log(content) 显示旧数据,没有我对 textarea 数据所做的更改。

有什么想法吗?

【问题讨论】:

  • 你想做什么?
  • 您使用的是updater()updateer(),您有错字吗?
  • 你不觉得ngModelinnerHTML 有冲突吗?
  • @micronyks 我想获取我的 textarea 的值。它实际上没有。没有错字,是粘贴后才添加的
  • 发布一个重现问题的 plunkr。并删除没有多大意义的[innerHTML]="page.content"

标签: angular


【解决方案1】:

多个问题:

  1. 您需要 ng2-ckeditor 才能使 ckeditor 与 Angular2 框架一起正常工作。

  2. Angular2(最新是2.1.1)现在发布了,beta.0真的很老了。 ng2-ckeditor 的当前版本基于 Angular2 模块导入模型,该模型是在 RC.5 中引入的。

  3. 让 ng2-ckeditor 工作,两者都

    index.html

    <script src="https://cdn.ckeditor.com/4.5.11/full/ckeditor.js"></script>

    Module Import

    import { CKEditorModule } from 'ng2-ckeditor';
    
    @NgModule({
      // ... 
      imports:      [
        CKEditorModule
      ],
      // ... 
    })
    

    是必需的。

我创建了一个有效的Plunker Here

【讨论】:

    猜你喜欢
    • 2011-03-10
    • 2021-12-22
    • 2017-02-21
    • 1970-01-01
    • 2012-11-21
    • 2012-10-28
    • 2018-06-08
    • 2018-06-16
    • 1970-01-01
    相关资源
    最近更新 更多