如何在kendo日期时间选择器中禁用日期(Angular)

时间:2016-12-23 06:43:47

标签: angularjs typescript kendo-ui

<input id="startDate" kendo-date-time-picker
           k-ng-model="vm.startDate"
           k-on-change="vm.updateStartDate()"
           required
/>

如何将禁用日期添加到此日期选择器? 不使用jquery !! 是否存在k-disabled-dates属性?

1 个答案:

答案 0 :(得分:1)

指定k-options属性:

<input id="startDate" kendo-date-time-picker
       k-ng-model="vm.startDate"
       k-on-change="vm.updateStartDate()"
       required,
       k-options="startDateOptions"
/>

然后使用disabledDates(http://docs.telerik.com/kendo-ui/api/javascript/ui/datetimepicker#configuration-disableDates)配置实现选项,但这适用于您的情况,即

$scope.startDateOptions = {
    disableDates: function (date) {
        var disabled = [13,14,20,21];
        if (date && disabled.indexOf(date.getDate()) > -1 ) {
            return true;
        } else {
            return false;
        }
    }
};

示例:http://dojo.telerik.com/@Stephen/eLuWE