Hi
I have a toggle, which when set to “true” gives the user a confirm dialog.
If the user cancels, the UI toggle does not revert to false.
I’ve attempted to use $scope.apply(), but it says it is already applying.
HTML:
<ion-toggle ng-model="useMobileData"
ng-change="updateMobileData(useMobileData)">
<b>Use Mobile Data</b>
</ion-toggle>
Javascript:
$scope.useMobileData = false;
$scope.updateMobileData = function (bool) {
if (bool) {
bool = confirm("Using Mobile Data may incur a cost, depending on your tariff");
}
//$scope.$apply(function () {
$scope.useMobileData = bool;
//});
};
Any help is appreciated!
EDIT:
Added a Code Pen:
I assume this is due to ng-model.