简体   繁体   English

angularjs datepicker动态设置最大日期和最小日期

[英]angularjs datepicker to set max date and min date dynamically

I am using below date-picker plugin for angularjs which is made from pickadate.js https://github.com/alongubkin/angular-datepicker 我正在使用以下日期选择器插件为angularjs,它是由pickadate.js https://github.com/alongubkin/angular-datepicker制成的

I am using this plugin twice on the page. 我在页面上两次使用了此插件。 Plugin have very good option max date and min date which will help us select between those date. 插件有一个很好的选项,最大日期和最小日期,这将帮助我们在这些日期之间进行选择。

Example options 示例选项

$scope.depOptions = {
    format: 'dd/mm/yyyy',
    min: minDate,
    max: maxDate,
    onClose: function(){
      $scope.arrOptions.min = $scope.depDate;
    }
  }

Now I want to make min date starting from selected. 现在,我要从选定的日期开始确定最小日期。 I tried $watch and also tried to onClose method provided by plugin but I could not do it. 我尝试了$ watch,也尝试了插件提供的onClose方法,但我做不到。 Kindly somebody help me. 请有人帮助我。

http://plnkr.co/edit/QBFwqyUIJxtw1dltMDky?p=preview http://plnkr.co/edit/QBFwqyUIJxtw1dltMDky?p=preview

It seems that the element's configuration once initialized cannot be changed. 似乎元素的配置一旦初始化就无法更改。 Try putting the arrival input in ngIf, so that it is always rendered anew when departure changes. 尝试将到达输入内容放入ngIf中,以便在出发点更改时始终重新呈现它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM