AngularJS KendoUI日期选择器模型未绑定
我想将今天的日期绑定到模型和剑道UI日期选择器,并使它们保持同步,但它不起作用。。。我的日期选择器从不在控件上显示模型值 这是我的代码:AngularJS KendoUI日期选择器模型未绑定,angularjs,kendo-ui,datepicker,Angularjs,Kendo Ui,Datepicker,我想将今天的日期绑定到模型和剑道UI日期选择器,并使它们保持同步,但它不起作用。。。我的日期选择器从不在控件上显示模型值 这是我的代码: vm.startDateOptions = { parseFormats: ["YYYY-MM-DD"] }; vm.searchInfos = { startDate: moment(new Date()).format('YYYY-M-D') // Giving 2015-10-14 for today } Html: <
vm.startDateOptions = {
parseFormats: ["YYYY-MM-DD"]
};
vm.searchInfos = {
startDate: moment(new Date()).format('YYYY-M-D')
// Giving 2015-10-14 for today
}
Html:
<input onkeydown="return false;" id="start" kendo-date-picker
k-options="vm.startDateOptions"
k-ng-model="vm.searchInfos.start"
style="width: 100%;" />
如果您想在html中使用值来显示它,您可以使用如下内容
<h4>Select date:</h4>
<input
kendo-date-time-picker
k-options="monthSelectorOptions"
data-k-ng-model="dateObject"
data-ng-model="dateString.startDate"
style="width: 100%;" />
var startDate = new Date();
$scope.monthSelectorOptions = {
value: startDate,
startDate: startDate,
format: "dd/MM/yyyy h:mm tt",
parseFormats: ['ddd MMM dd yyyy'],
animation: {
close: {
effects: "fadeOut zoom:out",
duration: 300
},
open: {
effects: "fadeIn zoom:in",
duration: 300
}
},
culture: "de-DE",
};
选择日期:
var startDate=新日期();
$scope.monthSelectorOptions={
值:startDate,
开始日期:开始日期,
格式:“dd/MM/yyyy h:MM tt”,
解析格式:['ddd-MMM-dd-yyyy'],
动画:{
关闭:{
效果:“淡出:缩小”,
持续时间:300
},
开放式:{
效果:“fadeIn放大”,
持续时间:300
}
},
文化:“德德”,
};
也许您在这里犯了一个错误
k-ng-model=“vm.searchInfos.start”
。您应该使用startDate
而不是start
.arg。。。。为了这样一个错误,我花了很多时间试图理解这个问题。。。。谢谢