JS fiddle: <http://jsfiddle.net/ernestsoo22/qqgj9jf5/1/>

I have a `ng-repeat` in my code like this:

```
<ul>
<li ng-repeat=" opt in courses">
    {{$index}}
</li>
</ul>

```

With this, I am able to get the output of:

> 
> 0 , 1 , 2 , 3
> 
> 
> 

**Problem:** Using a filter like such does not get the `$index` that I want:

```
<ul>
<li ng-repeat=" opt in courses | filter:{code:'INF'}"   >
    {{$index}}
</li>
</ul>

```

With this filter I get the `$index` of (refer fiddle):

> 
> 0 , 1
> 
> 
> 

Instead of this, what I am looking for is to get the actual index of the `courses` json object. So according to the filter, the output would be:

> 
> 2 , 3
> 
> 
> 

How can I achieve this while using a `filter`?