Angular2如何使用Ueditor?
ngx-ueditorAngular2.x for Baidu UEditor DemoLive Demo 特性
使用1、安装npm install ngx-ueditor --save 把 import { UeditorModule } from 'ngx-ueditor'; @NgModule({ imports: [BrowserModule,UeditorModule ],declarations: [AppComponent],bootstrap: [AppComponent] }) export class AppModule { } 2、使用<ueditor [(ngModel)]="full_source" [config]="{...}" [path]="'./assets/ueditor/'" (onReady)="" (onDestroy)="" (onContentChange)=""></ueditor>
3、关于懒加载懒加载在未到 加载语言注意点 懒加载会自动识别并引用,否则,需要自行在 访问ueditor实例对象首先,需要给组件定义一下模板变量: <ueditor [(ngModel)]="full_source" #full></ueditor> 使用 export class DemoComponent { @ViewChild('full') full: UeditorComponent; constructor(private el: ElementRef) {} getAllHtml() { // 通过 `this.full.Instance` 访问ueditor实例对象 alert(this.full.Instance.getAllHtml()) } } 事件虽说上节也可以直接注册ueditor事件,但当组件被销毁时可能会引发内存泄露。所以不建议直接在ueditor实例中这么做。组件本身提供 // 事件监听 this.full.addListener('focus',() => { this.focus = `fire focus in ${new Date().getTime()}`; }); // 事件移除 this.full.removeListener('focus'); 表单非空校验组件加入 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |