<ion-toggle ng-model=Obj.isDate ng-change="dateChange()"> Choose date <span class="item-note" ng-show="Obj.isDate">
On : {{Obj.Date | date:'mediumDate'}}
</span></ion-toggle>
$scope.dateChange = function () {
if ($scope.Obj.isDate)
{
var options = {
date: new Date(),
mode: 'date',
minDate: new Date() - 10000,
allowOldDates: false,
allowFutureDates: true,
doneButtonLabel: 'DONE',
doneButtonColor: '#F2F3F4',
cancelButtonLabel: 'CANCEL',
cancelButtonColor: '#000000',
x: "400",
y: "500",
androidTheme: window.datePicker.ANDROID_THEMES.THEME_DEVICE_DEFAULT_DARK
};
window.plugins.datePicker.show(options, function (date) {
if (angular.isDefined(date))
{
$scope.Obj.Date = date;
} else {
$scope.Obj.Date = new Date();
}
}, function (err) {
$scope.Obj.isDate = false; <===== ISSUE HERE
})
} else {
$scope.Obj.Date = null;
}
}
Here when user is pressing cancel button in date picker I need to turn off toggle button. But this code is not working. Toggle button model is not updating.