# Ng-repeat and ng-click with ng-show/ng-hide Problem

**URL:** <https://forum.ionicframework.com/t/ng-repeat-and-ng-click-with-ng-show-ng-hide-problem/57906>\
**Category:** ionic-v1\
**Created:** [July 19, 2016, 3:30am UTC](https://forum.ionicframework.com/t/ng-repeat-and-ng-click-with-ng-show-ng-hide-problem/57906 "2016-07-19T03:30:01Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Patmau5](https://avatars.discourse-cdn.com/v4/letter/p/8491ac/32.png) [@Patmau5](https://forum.ionicframework.com/u/Patmau5)\
**Post date:** [July 19, 2016, 3:30am UTC](https://forum.ionicframework.com/t/ng-repeat-and-ng-click-with-ng-show-ng-hide-problem/57906/1 "2016-07-19T03:30:01Z")

</div>

Hello, i dont know how to make it work. I want to create a hide/show checkbox with ng-show and ng-hide (handled by values). Need only activated when i check launch or dinner. i already did it without ng-repeat and works well, but i want to do this with ng-repeat. Any suggestions?

Sorry for my bad english, hope you understand.

[http://codepen.io/patmau5/pen/BzYYwk](http://codepen.io/patmau5/pen/BzYYwk)

---

<div class="post-metadata">

**Author:** ![harith5757](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/harith5757/32/100263_2.png) [@harith5757](https://forum.ionicframework.com/u/harith5757)\
**Post date:** [July 20, 2016, 3:49am UTC](https://forum.ionicframework.com/t/ng-repeat-and-ng-click-with-ng-show-ng-hide-problem/57906/2 "2016-07-20T03:49:22Z")

</div>

u want to create a hide and show div by using checkbox and when the user value is true then the div will show up?

---

<div class="post-metadata">

**Author:** ![Patmau5](https://avatars.discourse-cdn.com/v4/letter/p/8491ac/32.png) [@Patmau5](https://forum.ionicframework.com/u/Patmau5)\
**Post date:** [July 20, 2016, 4:01am UTC](https://forum.ionicframework.com/t/ng-repeat-and-ng-click-with-ng-show-ng-hide-problem/57906/3 "2016-07-20T04:01:34Z")

</div>

yes, that exactly what i want

---

<div class="post-metadata">

**Author:** ![harith5757](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/harith5757/32/100263_2.png) [@harith5757](https://forum.ionicframework.com/u/harith5757)\
**Post date:** [July 20, 2016, 4:38am UTC](https://forum.ionicframework.com/t/ng-repeat-and-ng-click-with-ng-show-ng-hide-problem/57906/5 "2016-07-20T04:38:07Z")

</div>

```
<html ng-app="ionicApp">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
    <link href="//code.ionicframework.com/nightly/css/ionic.css" rel="stylesheet">
    <script src="//code.ionicframework.com/nightly/js/ionic.bundle.js"></script>
  </head>

  <body ng-controller="MainCtrl">
    <ion-content>
    <ion-list >
      <ion-item ng-repeat="food in foods">
        <ion-checkbox ng-model="food.v" ng-change="showAlert(food.f,food.v)" ng-checked={{food.v}}>{{ food.f }}</ion-checkbox>
      </ion-item>
      
    </ion-list>
            <div ng-hide="com"></div>
            <div ng-show="com">
            <label id="datos-textarea1" class="item">Are you still hungry?</label>
            <ion-list>
            <ion-radio ng-model="choice" ng-click="mPostre=true" name="p" ng-value="'Apostre'">Yes</ion-radio>
            <ion-radio ng-model="choice" ng-click="mPostre=false" name="p" ng-value="'Bpostre'">No</ion-radio>
            </ion-list>
            </div>
      
      
    </ion-content>

```

 "

> angular.module(‘ionicApp’, [‘ionic’])  
> .controller(‘MainCtrl’, function($scope,$ionicPopup) {  
> $scope.foods=[  
> { f: ‘Breakfast’, v: false },  
> { f: ‘Lunch’, v: true },  
> { f: ‘Snack’, v: false },  
> { f: ‘Dinner’, v: true},  
> ];
> 
> ```
> $scope.showAlert = function(foodType,bool){
> if(bool){
> $ionicPopup.confirm({
> title: 'Info',
> template: 'You just had your '+foodType+', are you still hungry?',
> buttons:[
> {
> text:"Yes",
> onTap: function(e) {
> console.log('user click yes');
> }
> },
> {
> text:"No",
> onTap: function(e) {
> console.log('user click no');
> }
> }
> ]
> });
> }
> }
> })
> 
> ```

p/s sorry dont know how to paste codepen here =.=

---

<div class="post-metadata">

**Author:** ![Patmau5](https://avatars.discourse-cdn.com/v4/letter/p/8491ac/32.png) [@Patmau5](https://forum.ionicframework.com/u/Patmau5)\
**Post date:** [July 21, 2016, 5:13pm UTC](https://forum.ionicframework.com/t/ng-repeat-and-ng-click-with-ng-show-ng-hide-problem/57906/6 "2016-07-21T17:13:52Z")

</div>

its interesting function but, isnt what i want… I tried to make the connection the ng-click=“com.(true or false)” with the ng-repeat to works with the ng-show/ng-hide, and then the question of ‘are you still hungry’ should be appear only if i check launch or dinner (can choose only one checkbox).

Thanks anyways
