filtering and selecting ng-repeat in ionic 1


#1

Trying to filter ng-repeat and selecting an item. The filter functionality works fine, but the issue is that when I select a desired item from the filtered list I get value of the item at that position before filtering.

<div class="list">

                  <div class="item item-input-inset">
                    <label class="item-input-wrapper">
                            <i class="icon ion-search placeholder-icon"></i>
                      <input type="text" placeholder="Search" ng-model="search.name">
                    </label>

                  </div>

                </div>
    <ion-content scroll="true" class="has-header">
        <ion-list>
            <ion-radio ng-model="choice" ng-click="selected($index)" ng-repeat="item in lstCountry  | filter:search | limitTo:listlength">
                {{item.name}} ({{item.dial_code}})
            </ion-radio>
          </ion-list>