Hey guys,
I’m trying to get a datepicker to work for ionic using the cordova plugin date-picker
But it is not working. Here is my code
.directive('input', [function () {
return {
restrict: 'E',
scope: {
type: '@'
},
priority: -1,
link: function (scope, elem, attrs) {
try {
if (!(scope.type == 'date')) {
return
}
elem[0].addEventListener('focus', function (e) {
alert(datePicker.show);
var self = this;
var date = Date.parse(self.value || new Date());
datePicker.show({
date: date,
mode: 'date',
allowOldDates: true
}, function (returnDate) {
returnDate = new Date(returnDate);
self.value = returnDate.toString('dd/MMM/yyyy');
self.blur();
})
});
} catch (e) {
alert(e);
}
}
}
}]);
I don’t get any errors at all. What could the issue be?