【问题标题】:Kendo UI Angular2/4 rich text editorKendo UI Angular2/4 富文本编辑器
【发布时间】:2017-10-13 20:18:03
【问题描述】:

谁能提供有关如何在 Angular4 应用程序中集成 jQuery 组件 KendoEditor 的指针? 我已经集成了 jQuery 组件 Splitter 控件,但不确定集成 KendoEditor 的最佳方式是什么。 不幸的是,与早期版本的 KendoUI 控件(用于 ~AngularJS)相比,并非所有组件都存在于 Angular2/4 的 Kendo Angular UI 工具套件中。

任何指针都会有所帮助。 到目前为止,我已经尝试过使用类似的东西

textarea #questionEditor name = "questionEditor" rows="10" cols="30" 然后在 typescript 中使用@View 来获取这个编辑器的引用。它似乎失败并给出错误 -

无法读取未定义的属性“nativeElement”

另外,我使用div-tags 尝试了类似的方法,但到目前为止没有结果。

编辑

遇到此问题的任何人 - 在尝试来自 Kendo Angular World 的富文本或 Window JQuery 控件之前,请确保已加载您的 Kendo 主题

【问题讨论】:

    标签: jquery angular kendo-editor


    【解决方案1】:

    这可能会帮助您检查它

    import {Component, OnInit, ViewChild, ElementRef, AfterViewInit} from '@angular/core';
    declare var kendo: any;
    
    @Component({
      selector: 'app-text-editor',
      templateUrl: './text-editor.component.html',
      styleUrls: ['./text-editor.component.scss']
    })
    
    export class TextEditorComponent implements OnInit , AfterViewInit {
    
      @ViewChild("questionEditor") questionEditor : ElementRef;
    
      constructor() { }
    
      ngOnInit() { }
    
      ngAfterViewInit() {
         kendo.jQuery(this.questionEditor.nativeElement).kendoEditor({ resizable: {
           content: true,
           toolbar: true
         }});
      }
    }
    

    【讨论】:

    • 感谢您的回答。但我已经意识到,除非我们没有为组件加载/关联相关的“主题”,否则其中一些控件无法按预期工作。这是问题的根本原因。不幸的是,在 Kendo Angular 文档中没有明确提及这一点。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2023-03-15
    • 2011-06-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多