我将KendoUI与AngularJS一起使用。请帮助在KendoUI中全局设置TimePicker。我找不到执行此操作的方法。默认情况下,间隔设置为30分钟。

最佳答案

您可以使用k-interval属性设置间隔。并从控制器加载值。

选中此JSBin

  angular.module("KendoDemos", [ "kendo.directives" ])
      .controller("MyCtrl", function($scope){
          $scope.getType = function(x) {
              return typeof x;
          };
          $scope.isDate = function(x) {
              return x instanceof Date;
          };
          //one setting for controller, or you can set this using angular constant to be used in multiple controllers.
          $scope.timeInterval = 15;
      })


在您看来

 <input kendo-time-picker
             ng-model="str"
             k-ng-model="obj" k-interval="timeInterval" />


编辑:

要更新所有剑道时间选择器的时间间隔,可以执行以下操作。

 kApp.run(function($rootScope) {

    $rootScope.$on("kendoWidgetCreated", function(event, widget){

      //get the element
      var elem = widget.element[0];
      //get the kendoTimePicker.
      var tPicker = $(elem).data("kendoTimePicker");
      if(tPicker)
        tPicker.timeView.options.interval = 15;
  });


链接到JSBin with edit

09-25 16:59
查看更多