Angularjs ngChange不';不适用于在kendo.toolbarOptions中定义的剑道日期选择器
我想将ngChange事件绑定到kendo日期选择器,即工具栏选项中定义的日期选择器,但ngChange不起作用Angularjs ngChange不';不适用于在kendo.toolbarOptions中定义的剑道日期选择器,angularjs,kendo-ui,telerik,angularjs-ng-change,kendo-datepicker,Angularjs,Kendo Ui,Telerik,Angularjs Ng Change,Kendo Datepicker,我想将ngChange事件绑定到kendo日期选择器,即工具栏选项中定义的日期选择器,但ngChange不起作用 $scope.toolbarOptions={ 项目:[{ 模板:“来自” }, { 模板:“”, 溢出:“从不” }]}; $scope.startChange=function(){console.log('changed');} 函数startChange(){console.log('changed');}如果您使用的是ngChange,请使用ngChange进行更改,如下
$scope.toolbarOptions={
项目:[{
模板:“来自”
}, {
模板:“”,
溢出:“从不”
}]};
$scope.startChange=function(){console.log('changed');}
函数startChange(){console.log('changed');}
如果您使用的是ngChange,请使用ngChange进行更改,如下所示:-
$scope.toolbarOptions = {
items: [{
template: "<label>From</label>"
}, {
template: "<input id='start' kendo-date-picker ng-model='dateString' k-ng-model='dateObject' ng-change='startChange()' />",
overflow: "never"
}]};
$scope.startChange = function() {console.log('changed');}
$scope.toolbarOptions={
项目:[{
模板:“来自”
}, {
模板:“”,
溢出:“从不”
}]};
$scope.startChange=function(){console.log('changed');}
或者,如果您想调用javascript函数,则必须在使用js函数之前定义js函数
angular.module("KendoDemos", [ "kendo.directives" ])
.controller("MyCtrl", function($scope){
$scope.toolbarOptions = {
items: [{
template: "<label>From</label>"
}, {
template: "<input id='start' handle-change kendo-date-picker ng-model='dateString' k-ng-model='dateObject' onChange='startChange()' />",
overflow: "never"
}]
};
}).directive('handleChange',function(){
return{
link:function(scope,ele,attr){
//you can use this
//ele.on('change',function(){
//alert(555)
//})
//or
function startChange() {console.log('changed');}
}
}
});
angular.module(“KendoDemos”[“kendo.directives”])
.controller(“MyCtrl”,函数($scope){
$scope.toolbarOptions={
项目:[{
模板:“来自”
}, {
模板:“”,
溢出:“从不”
}]
};
}).directive('handleChange',function(){
返回{
链接:功能(范围、元素、属性){
//你可以用这个
//ele.on('change',function(){
//警报(555)
//})
//或
函数startChange(){console.log('changed');}
}
}
});
您正在使用ngChange,请使用ng change进行更改,如:-
$scope.toolbarOptions = {
items: [{
template: "<label>From</label>"
}, {
template: "<input id='start' kendo-date-picker ng-model='dateString' k-ng-model='dateObject' ng-change='startChange()' />",
overflow: "never"
}]};
$scope.startChange = function() {console.log('changed');}
$scope.toolbarOptions={
项目:[{
模板:“来自”
}, {
模板:“”,
溢出:“从不”
}]};
$scope.startChange=function(){console.log('changed');}
或者,如果您想调用javascript函数,则必须在使用js函数之前定义js函数
angular.module("KendoDemos", [ "kendo.directives" ])
.controller("MyCtrl", function($scope){
$scope.toolbarOptions = {
items: [{
template: "<label>From</label>"
}, {
template: "<input id='start' handle-change kendo-date-picker ng-model='dateString' k-ng-model='dateObject' onChange='startChange()' />",
overflow: "never"
}]
};
}).directive('handleChange',function(){
return{
link:function(scope,ele,attr){
//you can use this
//ele.on('change',function(){
//alert(555)
//})
//or
function startChange() {console.log('changed');}
}
}
});
angular.module(“KendoDemos”[“kendo.directives”])
.controller(“MyCtrl”,函数($scope){
$scope.toolbarOptions={
项目:[{
模板:“来自”
}, {
模板:“”,
溢出:“从不”
}]
};
}).directive('handleChange',function(){
返回{
链接:功能(范围、元素、属性){
//你可以用这个
//ele.on('change',function(){
//警报(555)
//})
//或
函数startChange(){console.log('changed');}
}
}
});
尝试了第二种解决方案,但仍引发异常startChange未定义您可以尝试新的更新代码,添加“句柄更改”说明谢谢您的回复。我的控制器很大,工具栏选项中有很多其他项目,有没有一种优雅的方法?你可以在父div中使用此指令,就像尝试第二个解决方案一样,仍然会引发异常startChange未定义你可以尝试新的更新代码,添加“句柄更改”指令谢谢你的回复。我的控制器非常大,工具栏选项中有很多其他项目,有没有一种优雅的方式?你可以在你的父div中使用这个指令,就像