Ionic popup close when i has chose option

I am early for Ionic.

I created popup ionic and it's work. but I got something problem, I want when I after make a choice ( with input radio ), a popup will close and change class a tags.

this my code app.js for popup :

.controller('PlaylistsCtrl',function($scope, $ionicPopup, $timeout) {

 // Triggered on a button click, or some other target
 $scope.showPopup = function() {
 $scope.data = {}

 // An elaborate, custom popup
 var myPopup = $ionicPopup.show({
 templateUrl: 'templates/Popuptes.html',
 scope: $scope,  
 });

 myPopup.then(function(res) {
 console.log('Tapped!', res);
 });

 $timeout(function() {
   myPopup.close(); //close the popup after 10 seconds for some reason
 }, 6000);

 };

});

and this my Popuptes.html :

<div id="popup"> 

<input type="text">
<br>
<input type="radio" name="tags" value="food" ng-model="data.tags">Food
<br>
<input type="radio" name="tags" value="drink" ng-model="data.tags">Drink
<br>
<a href="#">Show all..</a>


</div>

Anyone can help me? Thanks in advance, Regards :)

You can use 'myPopup.close();' for closing the popup after you make the choice. (ie listen for the radio select event in JQuery), and continue changing classes.

Make sure to remove auto close.

$timeout(function() {
myPopup.close(); //close the popup after 6 seconds for some reason
}, 6000);
//remove this.

<input type="radio" name="tags" value="food" ng-model="data.tags">Food if you are asking why its not changing, give ng-model="data.value" it will be assigned with new value. so that i will be reflected back.