为什么Angular UI bootstrap datepicker没有弹出?

时间:2014-03-28 02:31:36

标签: javascript html angularjs angular-ui-bootstrap

尝试使用angularUI bootstrap的popup datepicker演示。嵌入在其页面中的演示有效,但我的minimal plunker没有 - 按钮单击不会弹出日历。知道为什么吗?

JS:

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

    $scope.opened = true;
    console.log('opened is now: %s', $scope.opened);
  };

HTML:

   <h4>Popup</h4>
    <div class="row">
      <div class="col-md-6">
        <p class="input-group">
          <input type="text" class="form-control" ng-model="dt" is-open="opened">
          <span class="input-group-btn">
                <button class="btn btn-default" ng-click="open($event)"><i class="glyphicon glyphicon-calendar"></i></button>
              </span>
        </p>
      </div>
    </div>

1 个答案:

答案 0 :(得分:3)

问题是因为你没有在ng-model =&#34; dt&#34;中提供datepicker-popup datepicker弹出窗口的格式。输入

只需更改此

即可
<input type="text" class="form-control" ng-model="dt" is-open="opened">

到这个

<input type="text" class="form-control" datepicker-popup="{{format}}" ng-model="dt" is-open="opened">

检查此工作plunker