棱角分明的UI自举 - 日期选择器 - 我怎么才能限制在弹出的日期选择器? [英] Angular-ui-bootstrap - Date Picker - How can I restrict access to the date-selector in popup?

查看:155
本文介绍了棱角分明的UI自举 - 日期选择器 - 我怎么才能限制在弹出的日期选择器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前,我可以先选择年份,然后是一个月,然后日期。不过,我只需要访问月份和年份。我不知道如何禁用日期选择器选项。

At the moment, I can first select the year, then the month, and then, the date. However, I only need access to month and the year. I'm not sure how to disable the date-selector option.

另外,我想摆脱在日期选择器中的所有页脚按钮(今天,清等)为好。我怎样才能做到这一点?

Also, I would like to get rid of all the footer buttons (today, clear, etc) in the date-picker as well. How can I achieve this ?

我在寻找类似的东西'$ scope.showweeks = FALSE;'

I'm looking for something similar to '$scope.showweeks = false;'

下面是我Plunker例如

Below is my Plunker example

Plunker-月年选择器

请随时直接向我提供任何单证。到目前为止,我只能找到

Please feel free to direct me to any documentations available. So far, I could only find

http://angular-ui.github.io/bootstrap/

感谢

推荐答案

您可以尝试使用日期选择器的引导与jQuery由指令包裹着。

You can try to use datepicker for Bootstrap with jQuery wrapped by directive.

请参阅<大骨节病> Plunker

JS

var app = angular.module('plunker', []);

app.controller('MainCtrl', function($scope) {
  $scope.var1 = '07-2013';
});


app.directive('datetimez', function() {
    return {
        restrict: 'A',
        require : 'ngModel',
        link: function(scope, element, attrs, ngModelCtrl) {
          element.datetimepicker({
           format: "MM-yyyy",
           viewMode: "months", 
            minViewMode: "months",
              pickTime: false,
          }).on('changeDate', function(e) {
            ngModelCtrl.$setViewValue(e.date);
            scope.$apply();
          });
        }
    };
});

HTML

   <div id="date" class="input-append" datetimez ng-model="var1">
      <input data-format="MM-yyyy" type="text" id="input1" name="input1"></input>
      <span class="add-on">
        <i data-time-icon="icon-time" data-date-icon="icon-calendar"></i>
      </span>
    </div>

这篇关于棱角分明的UI自举 - 日期选择器 - 我怎么才能限制在弹出的日期选择器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆