I have radio inputs and want to ucheck state by click on radio if current radio is checked.
This code:
A simple solution that works on Angular 1.3+ is:
Template
Controller
let lastChecked = null
$scope.radioCheckUncheck = function (event) {
if (event.target.value === lastChecked) {
delete $scope.forms.selected
lastChecked = null
} else {
lastChecked = event.target.value
}
}
It's similar to the above solution, but maintains its own copy of the previous selection.