我正在尝试将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 { }
test.module.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未定义
答案 0 :(得分:1)
<强> app.module.ts 强>
type(instance)
<强> test.module.ts 强>
@NgModule({
imports: [BrowserModule,SharedModule,TestModule], //<<<<<<<-----here
declarations: [AppComponent],
bootstrap: [AppComponent]
})
export class AppModule { }