1

我正在尝试将ng2-ckeditor添加到测试项目中。为此,我在 systemjs.config.js 中添加了以下行

        'ng2-ckeditor': 'npm:ng2-ckeditor/lib/CKEditor.js'

shared.module.ts

import { NgModule }            from "@angular/core";
import { CommonModule }        from "@angular/common";
import { FormsModule }         from "@angular/forms";
import { CKEditorModule }      from "ng2-ckeditor";

@NgModule({
imports: [
    CommonModule,
    FormsModule,
    CKEditorModule
],
exports: [
    CommonModule,
    FormsModule,
    CKEditorModule
]
})

app.module.ts

import { NgModule, ChangeDetectorRef }      from "@angular/core";
import { BrowserModule } from "@angular/platform-browser";
import { AppComponent }   from "./app.component";
import { TestModule } from "./test/test.module";

@NgModule({
imports: [BrowserModule, TestModule],
declarations: [AppComponent],
bootstrap: [AppComponent]
})
export class AppModule { }

测试模块.ts

import { NgModule }            from "@angular/core";
import { CommonModule }        from "@angular/common";

import { SharedModule }        from "../share/shared.module";
import { TestComponent }       from "./test.component";
import { ChildComponent } from "./child/child.component";

@NgModule({
imports: [SharedModule],
declarations: [TestComponent, ChildComponent],
exports: [TestComponent]
})
export class TestModule { }

但收到错误。

原始异常:CKEDITOR 未定义

所有代码

4

1 回答 1

1

app.module.ts

@NgModule({
imports: [BrowserModule,SharedModule,TestModule],   //<<<<<<<-----here
declarations: [AppComponent],
bootstrap: [AppComponent]
})
export class AppModule { }

测试模块.ts

@NgModule({
imports: [CommonModule],                        //<<<<<<<-----here
declarations: [TestComponent, ChildComponent],
exports: [TestComponent]
})
于 2016-10-05T15:08:41.027 回答