Angular Bootstrap datepicker popup问题

时间:2016-06-13 10:53:43

标签: javascript angularjs datepicker angular-bootstrap

我有关于角度引导程序datepicker弹出窗口的问题。 当我点击图标打开datepicker弹出窗口时,它会将html附加到元素,但弹出窗口不会出现。

我检查了一切,但我被困在这里,我对它没有任何想法。 任何人都可以帮助我??

我使用角度引导v Version: 0.12.1 - 2015-02-20

我使用过这段代码:

<div class="input-group w-md">
                  <input type="text" class="form-control" datepicker-popup="{{format}}" ng-model="dt" is-open="opened" min-date="minDate" max-date="'2015-06-22'" datepicker-options="dateOptions" date-disabled="disabled(date, mode)" ng-click="open($event)" ng-required="true" close-text="Close" />
                  <span class="input-group-btn">
                    <button type="button" class="btn btn-default" ng-click="open($event)"><i class="glyphicon glyphicon-calendar"></i></button>
                  </span>
                </div>

检查控制台: enter image description here

Javascript控制器:

$scope.today = function() {
        $scope.dt = new Date();
    };
    $scope.today();

    $scope.clear = function () {
        $scope.dt = null;
    };

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

    $scope.toggleMin = function() {
        $scope.minDate = $scope.minDate ? null : new Date();
    };
    $scope.toggleMin();

    $scope.open = function($event) {
        $event.preventDefault();
        $event.stopPropagation();
        $scope.opened = !$scope.opened;
    };

    $scope.dateOptions = {
        formatYear: 'yy',
        startingDay: 1
    };

    $scope.format = 'dd.MM.yyyy';

1 个答案:

答案 0 :(得分:0)

您可以参考我的plunker

我将您的代码复制到我的plunker,使用open1()代替open($event)