• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

ng2-ueditor: Angular2 UEditor组件(Angular2 UEditor component)

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称:

ng2-ueditor

开源软件地址:

https://gitee.com/twp0217/ng2-ueditor

开源软件介绍:

ng2-ueditor

简介

Angular2 UEditor组件(Angular2 UEditor component)

安装

npm install ng2-ueditor --save

使用

  • 1.在项目中引入UEditor的JavaScript文件
<script type="text/javascript" src="assets/ueditor/ueditor.config.js"></script><script type="text/javascript" src="assets/ueditor/ueditor.all.js"></script>
  • 2.安装依赖包:ng2-ueditor
npm install ng2-ueditor --save
  • 3.在module中导入Ng2UeditorModule
import { Ng2UeditorModule } from 'ng2-ueditor';@NgModule({  declarations: [    AppComponent  ],  imports: [    BrowserModule,    FormsModule,    HttpModule,    Ng2UeditorModule  ],  providers: [],  bootstrap: [AppComponent]})
  • 4.在模板页面使用
<ng2-ueditor [(ngModel)]="content"></ng2-ueditor>

属性(Attributes)

名称类型默认值说明
settingany{}配置项

事件(Events)

名称参数说明
onReady-编辑器初始化完成
onValueChangevalue: string编辑器内容改变
onFocus-编辑器获得焦点

方法(Methods)

名称返回值说明
getContentvalue: string获取编辑器的内容
getPlainTxtvalue: string得到编辑器的纯文本内容,但会保留段落格式
getContentTxtvalue: string获取编辑器中的纯文本内容,没有段落格式
hasContentsvalue: boolean检查编辑区域中是否有内容

使用

import { Ng2Ueditor } from 'ng2-ueditor';@ViewChild('ueditor') ueditor: Ng2Ueditor;console.log('编辑器内容:'+this.ueditor.getContent());console.log('纯文本内容,保留段落格式:'+this.ueditor.getPlainTxt());console.log('纯文本内容,没有段落格式:'+this.ueditor.getContentTxt());console.log('是否有内容:'+this.ueditor.hasContents());

示例(基于angular-cli创建)

  • 1.进入到demo目录
cd demo
  • 2.安装依赖
npm install
  • 3.启动服务
ng serve

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
ng-boot-oauth: oauth2 demo with angularjs and springboot发布时间:2022-02-14
下一篇:
ngx-weui: WeUI for angular发布时间:2022-02-14
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap