ionic-datepicker
ionic-datepicker copied to clipboard
Feature request: callback on cancel
Would it be possible to implement an option where a callback function can be run if the user clicks cancel/close without picking a date?
If the user didn't pick a date then we are not passing anything in to the callback . So you can check the value you are getting to the callback function and then you can decide whether the user has selected a value or not.
+1
@rajeshwarpatlolla I have a fix for this, but I need to be able to access the repo to push. If you don't want to do that you can just add this:
if(typeof $scope.mainObj.closeCallback === 'function') {
$scope.mainObj.closeCallback();
}
after line 267 so that the code looks like this:
buttons.push({
text: $scope.mainObj.closeLabel,
type: 'button_close',
onTap: function (e) {
console.log('ionic-datepicker popup closed.');
if(typeof $scope.mainObj.closeCallback === 'function') {
$scope.mainObj.closeCallback();
}
}
});
Any news on this feature?
Please @rajeshwarpatlolla , accept @jgerstle changes, so we can handle callback cancel, also this change helps us to solve issue #317 and #207