JSFiddle - React, Tailwind, and code Playground
HTML
<div ng-app="myApp">
<ul ng-controller="Ctrl" container>
<div ng-show="currentItem">
showing options for: {{currentItem.name}}
</div>
<li ng-repeat="item in items" ng-click="showOptions(item)">
{{item.name}}
</li>
</ul>
</div>
JavaScript
var app = angular.module('myApp',[]);
function Ctrl($scope) {
$scope.items = [];
for (var i = 1; i < 11; i++) $scope.items.push({name:'item '+i});
}
app.directive('container', function(){
return function(scope, element, attributes) {
scope.showOptions = function(item) {
if (scope.currentItem === item) scope.currentItem = null;
else scope.currentItem = item;
console.log(scope.currentItem);
}
}
});