我无法使用AngularJS'月份模式中 ui-bootstrap的日期选择器。
这里是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';
})
每当我点击一个月时,它都会更改为&#39; 模式。这在白天模式下工作正常。
答案 0 :(得分:1)
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>
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>