【问题标题】:AngularJS - ui-date textbox editableAngularJS - 可编辑的 ui-date 文本框
【发布时间】:2014-06-03 07:05:39
【问题描述】:

我在AngularJS 中使用ui-date

<input name="dateofbirth" id="dateofbirth" type="text" ng-model="search.dateofbirth" ui-date="dateOptions" ui-date-format="mm/dd/yy">

当我点击textbox时,会弹出一个日历,但用户无法输入textbox

如何使这个文本框可编辑?

【问题讨论】:

    标签: angularjs uidatepicker


    【解决方案1】:

    你可以使用这个指令,当你点击文本字段时应该显示日历。这是工作小提琴

    http://jsfiddle.net/nabeezy/HB7LU/209/

    myApp.directive('calendar', function () {
            return {
                require: 'ngModel',
                link: function (scope, el, attr, ngModel) {
                    $(el).datepicker({
                        dateFormat: 'yy-mm-dd',
                        onSelect: function (dateText) {
                            scope.$apply(function () {
                                ngModel.$setViewValue(dateText);
                            });
                        }
                    });
                }
            };
        })
    

    【讨论】:

      猜你喜欢
      • 2016-05-01
      • 1970-01-01
      • 1970-01-01
      • 2013-01-13
      • 2012-04-10
      • 1970-01-01
      • 1970-01-01
      • 2010-11-18
      相关资源
      最近更新 更多