So i have uibDatepicker directive (https://angular-ui.github.io/bootstrap/#datepicker) where i want to send request for each day provided in datepicker, hit server with that date, and return if it should be disabled or not. The problem is that it's async call, and dateDisabled function does not handle promises. Any suggestions?
<span uib-datepicker datepicker-options="datepickerOptions" ng-model="selectedDate"></span>
-
$scope.datepickerOptions: {
dateDisabled: function (dateAndMode) {
if (dateAndMode.mode !== "day") {
return false;
}
//async call
TimeService.getIsDateAvailable(dateAndMode.date).then(function (data) {
//returns true or false
return data.data;
});
}
I tried a lot of solutions. I found this answer: Disable dates using factory response UI Bootstrap Datepicker
But i can't apply this to my code.