In the process of developing my application using the ionic framework, I encountered a challenge where I needed to deselect an ion-radio
button when clicking on an input
tag. Despite attempting to achieve this functionality through this ionic play link, I was unable to do so successfully.
HTML
<ion-content class="padding">
<label class="item item-input">
<div class="input-label">
<i class="ion ion-search"></i>
</div>
<input ng-click="uncheck($event)" type="text" ng-model="foodfilter" class="">
</label>
<ion-radio ng-model="filter.typefilter" ng-value="'A'">Choose A</ion-radio>
<ion-radio ng-model="filter.typefilter" ng-value="'B'">Choose B</ion-radio>
<ion-radio ng-model="filter.typefilter" ng-value="'C'">Choose C</ion-radio>
</ion-content>
JS
$scope.uncheck = function (event) {
if ($scope.filter.typefilter == event.target.value) $scope.filter.typefilter = false
}
Check out the ionic play link for more details