So I don't know if this is a problem with AngularJS, or my understanding.
In my app, I have an ng-repeat and I need to keep track of the active $index, which can be changed when you click on another item. So I thought I would do something like:
<body ng-init="active = -1">
    <span ng-repeat="item in items" ng-bind="item" ng-click="active = $index"></span>
</body>
But this does not work; I know if I change the ng-click to ng-click="select($index) and apply the change in my controller, this would work. But I'd like to know why the implementation above doesn't work.
Interestingly, if you don't have an ng-repeat, this DOES work, i.e:
<body ng-init="active = -1">
    <span ng-click="active = 0">Item 1</span>
    <span ng-click="active = 1">Item 2</span>
    ...
</body>
Here is a Plunker of these two scenarios. Why?
 
     
     
    