AngularJS UI的引导:不日期选择器在本月模式下工作 [英] AngularJS ui-bootstrap: Datepicker not working in month mode

查看:269
本文介绍了AngularJS UI的引导:不日期选择器在本月模式下工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法用AngularJS' UI自举的日期选择器本月模式。

I am unable to use AngularJS' ui-bootstrap's datepicker in the month mode.

下面是一个 plunker。

下面是我的模板

<html>

  <head>
    <link rel="stylesheet" href="style.css">
  </head>

  <body ng-app="TestApp">
    <div ng-controller="testController">

      {{dt}}
      <datepicker ng-model="dt.from" datepicker-mode="mode" min-mode="mode"></datepicker>
      <datepicker ng-model="dt.to" datepicker-mode="mode" min-mode="mode"></datepicker>
    </div>

    <script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.2.25/angular.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/angular-ui-bootstrap/0.11.0/ui-bootstrap-tpls.min.js"></script>

    <script src="script.js"></script>
  </body>

</html>

下面是我的 JS

var app = angular.module('TestApp', ['ui.bootstrap'])

app.controller('testController', function($scope) {
  $scope.dt = {to: '', from: ''};
  $scope.mode = 'month';

})

每当我点击了一个月,它改变的模式。这是在白天模式工作的罚款。

Whenever I click on a month, it changes to the 'day' mode. This is working fine in the day mode.

推荐答案

您code正在工作,-是引导用户界面(也需要角度更高版本)。

Your code is working as-is with the latest version of Bootstrap UI (also requires a later version of Angular).

<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.1/angular.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular-ui-bootstrap/0.13.3/ui-bootstrap-tpls.js"></script>

Plunker

如果升级不是一个选项,然后硬编码分钟模式,以一个月也适用。

If upgrading is not an option then hard-coding min-mode to month also works.

<datepicker ng-model="dt.from" datepicker-mode="mode" min-mode="month"></datepicker>
<datepicker ng-model="dt.to" datepicker-mode="mode" min-mode="month"></datepicker>

这篇关于AngularJS UI的引导:不日期选择器在本月模式下工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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