mon*_*tan 5 angular-cli ng-ckeditor angular
请不要将此问题标记为已解决,因为stackoverflow上没有可用的解决方案可以解决我的问题,我正在尝试将ng2-ckeditor ckeditor 集成到现有的angular 4项目中。我尝试遵循此处描述的步骤,但徒劳无功。我在git和stackoverflow上找到了不同的讨论,但对我没有用。
我进行如下
在我的索引文件中引用了以下js文件
1 <script src="https://cdn.ckeditor.com/4.5.11/full/ckeditor.js"></script>
2 <script src="config.js"></script>
Run Code Online (Sandbox Code Playgroud)
在我的app.module.ts中导入模块
import{CKEditorModule} from "ng2-ckeditor";
.
.
.;
imports: [
BrowserModule,
AppRoutingModule,
.
.
.,
CKEditorModule,
],
Run Code Online (Sandbox Code Playgroud)
但是当我尝试在我的应用程序中使用ckeditor代码时
<ckeditor [(ngModel)]="description" > </ckeditor>
Run Code Online (Sandbox Code Playgroud)
它被标记为未知元素,我得到以下文本提示
[Angular]
'ckeditor' is not a known element:
1. If 'ckeditor' is an Angular component, then verify that it is part of this module.
2. To allow any element add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component.
Run Code Online (Sandbox Code Playgroud)
当我运行ng serve命令时,编译成功,但未显示任何内容,并且出现以下控制台错误
Uncaught Error: Template parse errors:
'ckeditor' is not a known element:
1. If 'ckeditor' is an Angular component, then verify that it is part of this module.
2. To allow any element add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component. ("N' | translate:lang }}</span>
<div formControlName="description" [froalaEditor] ></div>
[ERROR ->]<ckeditor></ckeditor>
</mat-card-content>
</mat-card>
Run Code Online (Sandbox Code Playgroud)
任何帮助,将不胜感激
愚蠢的错误浪费了大量时间导入但忘记导出模块,
@NgModule({
imports: [... , CKEditorModule],
declarations: [
...
],
exports: [
...
CKEditorModule //Don't forget to export
],
})
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1044 次 |
| 最近记录: |