You must set the visibility in each element.
<div ng-controller="FruitCtrl"> <div ng-repeat='fruit in fruits'> <a href="#" ng-click='toggleShow(fruit)'>{{ fruit.title }}</a> <div ng-show='fruit.show'> {{ fruit.color }} </div> </div> </div>
And format JS as
function toggleShow(fruit) { fruit.show = fruit.show }
Your object will look something like this:
$scope.fruits = [ { title: 'apple', color: 'red', show : true }, { title: 'orange', color: 'orange', show : true }, { title: 'banana', color: 'yellow', show : true } ];
This way you can manage the default settings
Also, you don't need the toggle method, you can do it inline in the html tag:
<a href="#" ng-click='fruit.show = !fruit.show'>{{ fruit.title }}</a>
source share