I have a list of elements that when clicked should open one element, but now when I try to open one element it opens all the elements, and when I press it a second time it closes all the elements - can anyone please the advice where I am mistaking my code below . Thanks.
HTML
<div data-ng-repeat="item in items" layout="column"> <div layout="row"> <md-button class="md-primary" ng-click="toggleFilter()">Item {{$index + 1}}</md-button> </div> <div ng-hide="toggle"> </div> </div>
Js
$scope.toggle = true; $scope.toggleFilter = function() { $scope.toggle = $scope.toggle === false ? true : false; };
user6229034
source share