angular2中如何使用Ueditor

作者: 晓朔一一 | 来源:发表于2017-07-26 09:17 被阅读0次

Ueditor是一个强大的富文本编辑器,angular2是一个什么东西就不用多说了吧,但在angular2中又该如何使用它呢?

先前有看过很多的文档,都没有详细的介绍过,既然是美女怎么会没有人看呢?

开始!

1.首先你先要安装依赖包:

npm install ng2-ueditor --save

2.在module中导入Ng2UeditorModule

直接导入即可

3.在模板页面使用:

<ng2-ueditor [(ngModel)]="content" [setting]="setting"></ng2-ueditor>

4.在component中也要导入一下

注意红色的

但是这样就OK了吗?

有没有注意到步骤3的那个setting呢?

话不多说,直接上图:

setting设置

这里有官方的setting配置项:配置项

在ng2-ueditor标签上有一些事件(events),以及方法(methods)

事件和方法

但不要以为这就可以了,还没完呢,最容易忽略的一点:

要在入口的index.html中引入UEditor的JavaScript文件:

<script type="text/javascript" src="assets/ueditor/ueditor.config.js"></script>

<script type="text/javascript" src="assets/ueditor/ueditor.all.js"></script>

OK,打完收工!

相关文章

网友评论

    本文标题:angular2中如何使用Ueditor

    本文链接:https://www.haomeiwen.com/subject/qdrnkxtx.html