如何一次显示一个datepicker?

时间:2015-01-21 07:31:17

标签: angularjs twitter-bootstrap twitter-bootstrap-3

我正在使用来自" http://angular-ui.github.io/bootstrap/"的日期选择器 在我的页面中我使用了多个日期选择器,所以现在我可以一次打开两个,但我真正需要的是一次一个日期选择器,任何人都可以建议我一个答案。

代码

   angular.module('ui.bootstrap.demo').controller('DatepickerDemoCtrl',  
   function ($scope) {
   $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 = true;
 };

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

$scope.formats = ['dd-MMMM-yyyy', 'yyyy/MM/dd', 'dd.MM.yyyy', 'shortDate'];
$scope.format = $scope.formats[0];
});

0 个答案:

没有答案