Is it possible to modify the value of a variable declared in ng-repeat from the controller?
I am attempting to set an initial value for a basic variable called "opened" which is used for toggling within an ng-repeat, directly inside the controller.
<div ng-repeat="item in list">
<input type="checkbox" ng-model="active[$index]" ng-click="active[$index]?opened=true:''" />
<a href ng-click="opened=!opened"><span class="glyphicon" ng-class="opened ? 'glyphicon-triangle-bottom' : 'glyphicon-triangle-right'"></span></a>
{{item.title}}
<span ng-show="opened">{{item.title}}</span>
</div>
You can find an example demonstrating this concept on Plunker. http://plnkr.co/edit/lebA2dokhq2W4AsbjKWB?p=preview
Thank you,