Close popup when i chose input radio

hi all

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 until now, it doesn’t work .

this my code app.js

.controller('PopUp',function($scope, $ionicPopup ) {

 // 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.closeInController = function() {
    console.log('close');
    myPopup.close();
  }

}

});

and this my code popuptes.html

<div id="popup">
  <input type="text">
    <br>
  <input type="radio" name="tags" value="Food" ng-click="closeInController()" ng-model="data.food">Food
  <br>
  <input type="radio" name="tags" value="Drink">Drink
  <a href="#">
    Show all..
  </a>
</div>

please help me,
thanks in advance

Popup need return statement to close that what i remember.
try

  myPopup.closeInController = function() {
console.log('close');
return $scope.data.food;
}

thanks for reply,

i try, and still doesn’t work…

So please referral to this link it’s shows how to create popups in proper way :slight_smile: I used it a lot and its working for me. http://codepen.io/ionic/pen/zkmhJ

i’ll figure it out again :smile:

may I ask one more time?

there are any < input type=“text” > in file popuptes.html, if i chose food ( click radio ), < input type=“text” > will fill the value food…
can you help me?
thanks in advance

If you setup them to the same ng-model then i think yes :slight_smile: I new to angular too so give it try;)

me too, early for angular :smile:
was only added to < input type=“text” value="{{ data.foods }}" > …

Try using ng-model=“data.foods” maybe?:slight_smile:

oh yeah, it can too…

$scope.closeInController = function() {
console.log(‘close’);
myPopup.close();
return $scope.data.food;
}

worked for me