title: AngularJS determining the index in ng-repeat
body: <p>I'm trying to implement an asynchronous follow/unfollow function.. just like in instagram when you pull up the list of your followers there's an 'following'/'follow' button associated to each item.. for brevity i made the code simple. I'm using ionic framework</p>
  
  <p>my code in the view:</p>
  
  <pre><code>&lt;ion-list&gt;
      &lt;ion-item ng-repeat="user in users"&gt;
          &lt;span ng-click="followUser(user.id, indexHowTo??)"&gt;Follow&lt;/span&gt;
          &lt;p&gt;{{user.name}}&lt;/p&gt;
      &lt;/ion-item&gt;
  &lt;/ion-list&gt;
  </code></pre>
  
  
  
  <pre><code>$scope.followUser = function(userid, indexHowTo) {
  
      var to_from = {
          to_user: userid,
          from_user: $localStorage.CurrentUser.id
      }
      UserService.FollowUser(to_from, $localStorage.CurrentUser.auth_token)
          .success(function(data) {
              $scope.users[index].is_following = true; //i'll do something in the view just didn't show for brevity
  
          }).
      error(function(error, status) {
          //alert(status);
          console.log(error);
      });
  
  }
  </code></pre>