小编use*_*852的帖子

如何在 Angular2 中使用具有反应形式的“ckeditor”?

我是 angular2 的新手。我正在使用 ckeditor 创建一个反应式表单。一切都很好,但我的 ckeditor 数据没有发布。它是空的。我正在阅读指南并创建它,但我无法获得完美的结果。

im user form[formGroup] createPage 并在此表单中使用 ckditor。但我无法获得ckeditor的数据。我如何使用表单从 ckeditor 获取数据。在表单提交按钮中单击。

这是我的 ckeditor.ts 文件

import { Component, OnInit, Input } from '@angular/core';
@Component({
  selector: 'CKEDITOR',
  template: `
     <textarea name="targetId" id="targetId"  rows="rows" cols="cols">
         {{content}}
     </textarea>`
})
export class AdminCkeditorComponent implements OnInit {
  content: any = "test content";
  @Input() targetId;;
  @Input() rows = 10;
  @Input() cols;     
  constructor() { }
  ngOnInit(){
    window['CKEDITOR']['replace']( 'targetId' );
  }
}
Run Code Online (Sandbox Code Playgroud)

这是 page.ts 文件

import { FormGroup, FormControl } from '@angular/forms';
import { Component, …
Run Code Online (Sandbox Code Playgroud)

ckeditor angular2-forms angular-reactive-forms

4
推荐指数
2
解决办法
5919
查看次数