【问题标题】:Kendo UI Editor Events in AngularjsAngularjs 中的 Kendo UI 编辑器事件
【发布时间】:2015-10-05 13:37:51
【问题描述】:

如何从 Kendo UI Editor 中的事件中获取事件属性?

我从 KendoDemo 下载中获取了代码并对其进行了一些编辑以获取 k-on-changek-on-keydown 的事件。 这些事件被描述为here

<div id="example" ng-app="KendoDemos">
    <div ng-controller="MyCtrl">
            <textarea kendo-editor k-ng-model="html" k-on-keydown="keydown(e)" k-on-change="onChange(e)"></textarea>
    </div>
</div>

<script>
  angular.module("KendoDemos", [ "kendo.directives", "ngSanitize" ])
      .controller("MyCtrl", function($scope){
          $scope.html = "<h1>Kendo Editor</h1>\n\n" +
          "<p>Note that 'change' is triggered when the editor loses focus.\n" +
              "<br /> That's when the Angular scope gets updated.</p>";
          $scope.onChange = function(e){
            console.log('onchange');
            console.log(e);
          };
          $scope.keydown = function(e){
            console.log('keydown');
            console.log(e);
          }
      })
</script>

事件方法 onChange 和 keyDown 中的输出没有给我文档中描述的e 属性。

我错过了什么?

【问题讨论】:

    标签: angularjs kendo-ui kendo-editor


    【解决方案1】:

    橡皮鸭调试效果开始...

    找到我要找的东西,使用k-options添加所有选项。

    <div id="example" ng-app="KendoDemos">
        <div ng-controller="MyCtrl">
                <textarea kendo-editor k-ng-model="html" k-options="options"></textarea>
        </div>
    </div>
    
    <script>
      angular.module("KendoDemos", [ "kendo.directives", "ngSanitize" ])
          .controller("MyCtrl", function($scope){
              $scope.html = "<h1>Kendo Editor</h1>\n\n" +
              "<p>Note that 'change' is triggered when the editor loses focus.\n" +
                  "<br /> That's when the Angular scope gets updated.</p>";
              $scope.options = {
                  change: function(e){console.log(e);},
                  keydown: function(e){console.log(e);}
              };
          })
    </script>
    

    【讨论】:

    • 我遇到了同样的问题,无法捕获事件。但是,上面的解决方案对我不起作用。我的问题可能与 windows mobile 有关。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2023-04-10
    • 2014-05-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-07-16
    • 1970-01-01
    相关资源
    最近更新 更多