here is the code: 

```
<ul>
  <li ng-repeat="i in items" ng-class="{'red': click}">
    <span ng-click="click = !click">{{i}}</span>
  </li>
</ul>

<ul>
  <li ng-repeat="j in items" ng-class="{'red': f_click}">
    <span ng-click="fun_click($index)">{{j}}</span>
  </li>
</ul>

```

`f_click` change in `fun_click` function.

```
$scope.fun_click = (idx) ->
    $scope.f_click = !$scope.f_click

```

the complete codes:
<http://plnkr.co/edit/Zmoqbv?p=preview>

I wonder that the variable `click` in the first list is a local variable for each ng-repeat element ?  

how was it work ?

How could I make the `f_click` in the second list works like the `click` ?  

Seems the `$scope.f_click` is the only one variable in the ng-controller.

---

Updated:

I think I just did things wrong.  

I should not write things in "View".

read-only in View;  

write-only in Controller.  

<http://www.jacopretorius.net/2013/07/angularjs-best-practices.html>