I am trying run ckeditor with Angular2. I'm using the Angular CLI, and I have a very basic working app.

I have intstalled this package using npm install ng2-ckeditor. I have set my system.config.js file exactly as per their example, ie:

System.config({
    "map": {
      "ng2-ckeditor": "npm:ng2-ckeditor",
    },
    "packages": {
      "ng2-ckeditor": {
        "main": "lib/index.js",
        "defaultExtension": "js",
      },
    }
  });

and included it in my app.modules.ts in the same way:

import { CKEditorModule } from 'ng2-ckeditor';

@NgModule({
  // ...
  imports:      [
    CKEditorModule
  ],
  // ...
})
export class AppModule { }

After running ng build and ng serve I get the following error in my console:

Unexpected value 'CKEditorModule' imported by the module 'AppModule'

I don't understand why?

share|improve this question

I found a way to this problem:

  1. In your index.html just add this in the header block:

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

  1. Install ng2-ckeditor via NPM

    npm install ng2-ckeditor --save

  2. In your app.component.ts add this:

    import { CKEditorComponent } from '../../../node_modules/ng2-ckeditor/src/ckeditor.component'; @NgModule({ declarations: [ CKEditorComponent ], exports: [ CKEditorComponent, ] })

  3. Use editor like this:

    <ckeditor [(ngModel)]="myContent" debounce="500"></ckeditor>

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.