【发布时间】:2016-04-13 08:16:13
【问题描述】:
我有一个 Angular 2 的项目,我想使用来自definitelyTyped Repo 的 CKEditor 打字稿定义
https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/ckeditor/ckeditor.d.ts
问题是我收到错误Evaluating http://localhost:3000/typings/ckeditor/ckeditor.d.ts 这是我包含 ckeditor 文件的代码。
import {CoursesService} from "../../../services/courses"
/// <reference path="../../../../typings/ckeditor/ckeditor.d.ts" />
import {CKEDITOR} from "../../../../typings/ckeditor/ckeditor.d.ts"
export class CreateCourseComponent implements OnInit {
ngOnInit(){
CKEDITOR.replace('text_area');
}
}
【问题讨论】:
-
不,这不是那个问题的重复。这个问题是关于如何使用 CKEDITOR。这一篇是关于如何为CKEDITOR 使用DefinitelyTyped 类型定义。它们是互补的。
-
这是这个问题的答案:(1)运行
npm install -D @types/ckeditor(2)将其添加到您将访问CKEDITOR全局的打字稿文件的最顶部(必须是第一行,或在其他三斜杠指令之后):///<reference types="ckeditor" />
标签: angular angular2-directives