When I use Ionic toggle with on-change function, it works fine.
<ion-toggle ng-model="pushNotification.checked"
ng-change="pushNotificationChange()">
After adding ng-true-value and ng-false-value the model is not changed, or at least not in on-change function. It changes within the view however, showing binded value correctly.
<ion-toggle ng-model="emailNotification"
ng-true-value="'Subscribed'"
ng-false-value="'Unubscribed'"
ng-change="emailNotificationChange()">
In controller:
$scope.pushNotificationChange = function() {
console.log('Push Notification Change', $scope.pushNotification.checked);
};
$scope.emailNotificationChange = function() {
console.log('Email Notification Change', $scope.emailNotification);
};
Here's the code: https://codepen.io/anon/pen/jqjjZP
Push Notifications toggle logs correctly to the console, while Newsletter toggle always logs 'Subscribed'.
Why?