title: Using ng-if to select second item in an ng-repeat loop
body: <p>I'm working on a page that loops through a bunch of content and orders/groups them out by day. The grouping works, but I want to treat the first two items in the loop differently from the rest of them. I've tried utilizing <code>ng-if</code> in the code example below using <code>ng-if="$first || $index == 1"</code> and <code>ng-if="!$first || !$index != 1"</code> but it doesn't seem to be doing the trick.</p>
  
  <p>What is the proper way to select the first and second items in an <code>ng-repeat</code> loop? </p>
  
  <pre><code>&lt;div class="col-sm-12 day-block" ng-repeat="(key,value) in article.items | groupBy:'posted|date: MMM:dd' | toArray:true "&gt;
    &lt;div class="col-sm-2 timestamp"&gt;
      &lt;h3&gt;March 9&lt;/h3&gt;
      &lt;h1&gt;Day 4&lt;/h1&gt;
    &lt;/div&gt;
    &lt;div class="col-sm-10" ng-repeat="article in value | orderBy:'posted' | unique: 'nid'"&gt;
        &lt;div class="col-sm-12"&gt;
          &lt;div class="row"&gt;
            &lt;div class="col-xs-6" ng-if="$first || $index == 1"&gt;
              &lt;span ng-class="blog-post-thumbnail" ng-bind-html="to_trusted(article.main_image)"&gt;&lt;/span&gt;
              &lt;h2 ng-bind-html="to_trusted(article.node_title)"&gt;&lt;/h2&gt;
              &lt;h4 ng-bind-html="to_trusted(article.author)"&gt;&lt;/h4&gt;
              &lt;h4 ng-bind-html="to_trusted(article.posted)"&gt;&lt;/h4&gt;
            &lt;/div&gt;
          &lt;/div&gt;
  
        &lt;div class="row" ng-if="!$first || $index != 1"&gt;
          &lt;div class="col-xs-4"&gt;
            &lt;span ng-class="blog-post-thumbnail" ng-bind-html="to_trusted(article.main_image)"&gt;&lt;/span&gt;
          &lt;/div&gt;
  
          &lt;div class="col-xs-8"&gt;
            &lt;h3 ng-bind-html="to_trusted(article.node_title)"&gt;&lt;/h3&gt;
            &lt;h4 ng-bind-html="to_trusted(article.author)"&gt;&lt;/h4&gt;
          &lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>