Angular bootstrap.ui datepicker没有弹出

时间:2014-09-24 05:32:31

标签: angularjs datepicker angular-ui-bootstrap

我正在尝试在我的项目中使用angularjs日期选择器,但似乎当我将日期选择器集成到我的项目时,功能已被破坏

<div class="input-group">
    <div class="input-group ui-datepicker">
        <input type="text"
                class="form-control"
                datepicker-popup="yyyy/MM/dd"
                ng-model="dt"
                is-open="opened"
                max="'2015-06-22'"
                datepicker-options="dateOptions"
                date-disabled="disabled(date, mode)"
                ng-required="true"
                close-text="Close">
        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
    </div>
</div>

控制器

$scope.dt = new Date();
$scope.open = function ($event) {
    $event.preventDefault();
    $event.stopPropagation();
    return $scope.opened = true;
};
$scope.dateOptions = {
    'year-format': "'yy'",
    'starting-day': 1
};

$scope.disabled = function (date, mode) {
    return mode === 'day' && (date.getDay() === 0 || date.getDay() === 6);
};

那里缺少什么?

感谢

这是plunkr

1 个答案:

答案 0 :(得分:0)

您只需要将ng-click="open($event)"添加到元素(例如范围),它就会起作用。

http://plnkr.co/edit/bNNrFaeRl6iqFPfa3FMW?p=preview