Reputation: 8685
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?
Upvotes: 3
Views: 3868
Reputation: 499
I found a way to this problem:
<script src="https://cdn.ckeditor.com/4.6.1/full/ckeditor.js"></script>
Install ng2-ckeditor via NPM
npm install ng2-ckeditor --save
In your app.component.ts add this:
import { CKEditorComponent } from '../../../node_modules/ng2-ckeditor/src/ckeditor.component';
@NgModule({
declarations: [
CKEditorComponent
],
exports: [
CKEditorComponent,
]
})
Use editor like this:
<ckeditor [(ngModel)]="myContent" debounce="500"></ckeditor>
Upvotes: 6