I know the cordovaDatePicker has lots of issues, but what I’m seeing is probably something I’m messing up. The document “deviceready” event never fires and I’ve tried a lot of different solutions. Here’s my current, tortured code:
$scope.$on("$ionicView.loaded", function(event, data){
// handle event
console.log("LOADED: ", data.stateParams);
initDatePicker();
});
function initDatePicker() {
console.log( "initDatePicker");
document.addEventListener("deviceready", function() {
console.log( "event listener");
$cordovaDatePicker.show(options).then(function(date) {
if (date) {
if (currentState('time')) {
$scope.newJob.startTime = date.getTime();
}
} else {
console.log('Date undefined'); // Cancel clicked
}
});
}, false);
}
$ionicView.loaded fires so I know I’m registering for the document event, but it never comes in. Originally I had the document.addEventListener code in the controller function, but it stopped working at some point. All thoughts are welcome.