angularjs - conditional min and max date in uib-datepicker -
i want add uib-datepicker in ng-repeat. each item has own min , maxdate, want conditional set datepicker.
currently have this, isn't working:
<p class="input-group"> <input class="form-control" type="text" uib-datepicker-popup="dd-mm-yyyy" ng-model="task.dateplanned" is-open="popup.opened" datepicker-options="dateoptions($index)" close-text="sluiten"> <span class="input-group-btn"> <button class="btn btn-default" type="button" ng-click="opendate()"> <i class="fa fa-calendar"></i> </button> </span> </p> controller:
$scope.dateoptions = function(index){ return { maxdate: new date($scope.campaign.tasks[index].enddate), mindate: new date($scope.campaign.tasks[index].startdate) } } $scope.opendate = function(){ $scope.popup.openend = true; } $scope.popup = { openend: false } i error: [$rootscope:infdig] error @ min , maxdate.
is there way add conditional dates picker?
each item has own min , maxdate, want conditional set datepicker.
if requirement set separate min, max each item, expand object definition in tag itself, this:
<p class="input-group"> <input class="form-control" type="text" uib-datepicker-popup="dd-mm-yyyy" ng-model="task.dateplanned" is-open="popup.opened" datepicker-options="{ maxdate: task.enddate, mindate: task.startdate }" close-text="sluiten"> <span class="input-group-btn"> <button class="btn btn-default" type="button" ng-click="opendate()"> <i class="fa fa-calendar"></i> </button> </span> </p>
Comments
Post a Comment