title: Show ng-repeat selectively in AngularJs
body: <p>I am having a data as below. There are 2 types of questions one which have pictures as answer and other which has options as answer.</p>
  
  <pre><code>$scope.data = [
       {'question': "Select one.", 'pic': false,
         'answer': [
                {"option": "8",      "correct": false},
                {"option": "14",     "correct": false},
                {"option": "1",      "correct": true},
                {"option": "23",     "correct": false} 
              ]
  
        },
  
         {'question': "Select another right answer.", 'pic': true,
         'answerPic': [
                {"option": "img/pic1.jpeg",      "correct": false},
                {"option": "img/pic2.jpeg",     "correct": false},
                {"option": "img/pic3.jpeg",      "correct": true},
                {"option": "img/pic6.jpeg",     "correct": false} 
              ]
  
        },
  
     ]
  </code></pre>
  
  <p>I have used the below code to present them in the view. As you can see there are two block of <code>ng-repeat</code>, one for each type. But how do I make angular choose a particular type looking the pic value in the data? For example if pic is true angular should use the block for picture. And otherwise the normal one. </p>
  
  <pre><code>&lt;div class="text"&gt;
    &lt;label ng-repeat="a in question.answer"&gt;
        &lt;input type="radio" name="answers"&gt; 
        &lt;div class="item-content"&gt;
              {{ a.option }}
        &lt;/div&gt;
     &lt;/label&gt;
  &lt;/div&gt;
  
  &lt;div class="picture"&gt;
    &lt;label ng-repeat="a in question.answer"&gt;
        &lt;input type="radio" name="answers"&gt; 
        &lt;div class="item-content"&gt;
              &lt;img src="{{ a.option }}" /&gt;
        &lt;/div&gt;
     &lt;/label&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>As of now, the only option that I can think of is, using <code>ng-show</code> and <code>ng-hide</code>. Then I will be able to pass the <code>pic</code> value from data to it. But it looks like a hack to me. What would be the best way to solve this kind of a scenario?</p>