title: Angularj JS context menu
body: <p>I am looking for a context-menu directive that can tell me what was actually clicked so i can react to it.</p>
  
  <p>Was playing with <a href="https://github.com/Templarian/ui.bootstrap.contextMenu" rel="nofollow">this</a> but the problem of that module is that I can't figure out how to uniquely identify the element that was clicked. So I can do the correct logic on it:</p>
  
  <p>I would need something that I can pass into the callback function</p>
  
  <p><strong>Controller:</strong></p>
  
  <pre><code>$scope.items.Data = [{Code:'row1', Name:'Name1'},{Code:'row2', Name:'Name2'}]
  $scope.items.Actions = [
      {
          Code: 'Action1',
          Name: 'First action'
      },
      {
          Code: 'Action2',
          Name: 'Second action'
      }   
  ]
  
  var actionList = [];
  for (var i = 0; i &lt; $scope.items.Actions.length; i++) {
  
              actionList.push($scope.items.Actions[i].Name, function ($itemScope,$event) {
                  console.log('Action executed', $scope.objectId, $itemScope,$event,$itemScope.$index);
                  // Need access to $scope.items.Actions[i].Code or at least the index of the array
              });
  }
  $scope.contextOptions = actionList;
  </code></pre>
  
  <p><strong>HTML:</strong></p>
  
  <pre><code>&lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;td&gt;Code&lt;/td&gt;
              &lt;td&gt;Name&lt;/td&gt;       
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr ng-repeat="row in items.Data" context-menu="contextOptions"&gt;
              &lt;td&gt;{{row.Code}}&lt;/td&gt;
              &lt;td&gt;{{row.Name}}&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
  &lt;/table&gt;
  </code></pre>