$index not working properly with OrderBy
<pre><code>&lt;div ng-repeat="msg in currDateByMsg[msgDate.strDate]|orderBy :'-SendMsgDate':true"&gt;
     &lt;div ng-if="!msg.currentUser"&gt;
       &lt;div data-ng-if="$first || (currtDateByMsg[msgDate.strDate][$index].userId !=
         currDateByMsg[msgDate.strDate][$index -1].userId)"&gt;
         &lt;img class="img-circle" ng-src="{{msg.iconPath}}"/&gt; 
       &lt;/div&gt;
     &lt;/div&gt;
     &lt;div&gt;{{msg.userMessage}}&lt;/div&gt;
&lt;/div&gt;
</code></pre>

<p>i want to skip images when more than on message come from same user(i.e- show only one image).I'm iterating in reverse order but $index value is taking from 0. so how i reverse the index value too.</p>