2015-10-05 38 views
1

如何從Kendo UI Editor中的事件中獲取事件屬性?Kendo UI Editor Angularjs中的事件

我已經從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財產。

我錯過了什麼?

回答

2

橡膠鴨調試效果踢...

找到了我一直在尋找,添加使用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> 
+0

我有同樣的問題無法捕捉事件。但是,上述解決方案不適合我。我的問題可能與Windows Mobile有關。 –