如何从 Kendo UI 编辑器中的事件获取事件属性?
我从 KendoDemo 下载中获取了代码并对其进行了一些编辑,以获取 k-on-change
和 k-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
属性。
我错过了什么?
最佳答案
橡皮鸭调试效果开始...
找到了我正在寻找的内容,使用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>
关于angularjs - Angularjs 中的 Kendo UI 编辑器事件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32950034/