Milind
Milind

Reputation: 1955

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

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. Kindly somebody help me.

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

Upvotes: 1

Views: 12153

Answers (1)

Aneesh Kallarakkal
Aneesh Kallarakkal

Reputation: 333

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.

Upvotes: 1

Related Questions