2016-05-03 65 views
1

我也做了以下步骤:NG2-CKEditor的 “CKEDITOR”

  1. 安装NG2-CKEditor的 -JSPM:JSPM安装NG2-的CKEditor = github上:chymz/NG2-CKEditor的 -NPM:NPM安装NG2-CKEditor的
  2. 创建TS文件:

    import {Component} from 'angular2/core'; 
    import {CKEditor} from 'ng2-ckeditor'; 
    
    @Component({ 
        selector: 'sample', 
        directives: [CKEditor], 
        template: ` 
        <ckeditor [(ngModel)]="ckeditorContent" [config]="{uiColor: '#99000'}"></ckeditor>` 
    }) 
    export class Sample{ 
        constructor(){ 
        this.ckeditorContent = `<p>My HTML</p>`; 
        } 
    } 
    

但在运行时我得到一个异常“CKEDITOR未定义”。

我试图导入“CKEditor的”本身, 但在这种情况下,我有另外一个运行时异常 “的CKEditor遗漏的类型错误不能设置属性‘目录’未定义的”

感谢。

回答

3

您错过了一个步骤。您需要在HTML中包含一个指向CKEditor实际源文件的链接。去here并选择一个版本。包括它如下:

<script src="//cdn.ckeditor.com/4.5.8/full/ckeditor.js"></script> 

其余步骤如您所述。

编辑

在你没有设置正确SystemJS情况下应该是这个样子:

System.config({ 
     packages: { 
      "app": { 
       "format": 'register', 
       "defaultExtension": 'js' 
      }, 
      "ng2-ckeditor": { 
       "defaultExtension": "js" 
      } 
     }, 
     map: { 
      "ng2-ckeditor": "node_modules/ng2-ckeditor/lib/CKEditor.js" 
     } 
    }); 
+0

这个是什么system.config码的位置? – MohammedAshrafali

相关问题