It depends on your particular need but maybe you can write the result of the selection directly in the item like so
<ul>
<li ng-repeat="item in items" ng-class="{'selected':item.selected}">
<a href="" ng-click="toggle(item)">{{item.text}}</a>
</li>
</ul>
where
$scope.toggle = function (item) {
item.selected = !item.selected;
};
See a minimalist demo here : http://jsfiddle.net/9qLm4/1/
Or you could use $index to store your selection into a different array like so
<ul>
<li ng-repeat="item in items" ng-class="{'selected':selection.indexOf($index)!=-1}">
<a href="" ng-click="toggle($index)">{{item}}</a>
</li>
</ul>
where
$scope.selection = [];
$scope.toggle = function (idx) {
var pos = $scope.selection.indexOf(idx);
if (pos == -1) {
$scope.selection.push(idx);
} else {
$scope.selection.splice(pos, 1);
}
};
See a minimalist demo here : http://jsfiddle.net/j5T2y/2/
I have a preference for the former, which is more consistent.