假设我有以下kendo-editor:
<div kendo-editor ng-model="name" k-options="editorOptions"></div>
然后,我有以下editorOptions
:
function onChange(e) {
alert("I am changing.");
}
$scope.editorOptions = { change: onChange };
如何在不使用普通jQuery选择的情况下触发onChange事件来访问实际的kendo-editor对象:
示例:$("#myEditor").kendoEditor().trigger("change")
答案 0 :(得分:1)
您必须在当前范围(http://docs.telerik.com/kendo-ui/AngularJS/introduction#getting-widget-references)中定义控件引用,并且可以将事件定义为属性:
<div ng-app="app" ng-controller="MyCtrl">
<div kendo-editor="kendoEditorControl" ng-model="name" k-options="editorOptions" k-on-change="onChange()"></div>
</div>
<script>
angular.module("app", [ "kendo.directives" ]).controller("MyCtrl", function($scope) {
$scope.onChange = function() {
alert($scope.kendoEditorControl.value());
};
});
</script>