I would like to know how to set in the placeholder of a Datepicker a today date. I have a directive and I want to show in the placeholder the today date or in my case is also the minDate. I tried few solution I found online but I cannot show it and I don't know what I'm missing. If you can provide an example like in JSFiddle or Plunker will be appreciated.
This is my input field:
<input type="text " class="datepicker clearTimeField cursor-pointer" name="startDateBanner " id="startDateBanner " ng-model="customStartDate" ng-options="datepickerOptions" jqdatepickerbanner />
My directive:
}).directive('jqdatepickerbanner', function() {
return {
restrict: 'A',
require: 'ngModel',
link: function(scope, element, attr, ctrl) {
element.datepicker({
dateFormat: 'dd-mm-yy',
changeMonth: true,
changeYear: true,
//maxDate: Date.today(),
maxDate: '+6mm', // 6 Months max date
minDate: Date.today(),
showOn: "both",
buttonImage: "/img/calendar-o.png",
onSelect: function(date) {
ctrl.$setViewValue(date);
ctrl.$render();
scope.$apply();
}
});
}
};
});