I'm creating a tour booking system in AngularJS with Material Design.
The tours are generated into the DOM with ng-repeat. Every tour object contains information about on which dates this tour should be available. I need to send the tour object containing this information to the md-date-filter function, but I don't know how to do it.
HTML:
<div ng-repeat="tour in tours">
<md-datepicker
ng-model="tour.group.selectedDate"
md-min-date="booking.visit.dateStart"
md-max-date="booking.visit.dateEnd"
md-date-filter="disableDepDates"
></md-datepicker>
</div>
This is the date filter function:
$scope.disableDepDates = function(date) {
console.log(date);
//Check date here and return true if date is ok
};
The problem is that whenever I do md-date-filter="disableDepDates(tour)" in the HTML, the date filter object gets lost.
Thank you!
EDIT
I've also noted that when I use md-date-filter="disableDepDates(tour)", the disableDepDates() function will run spontaneously at page load, whenever I focus on any form element etc. By default, md-date-filter will be a function as stated here:
https://material.angularjs.org/latest/api/directive/mdDatepicker