this is my menu:
<md-menu>
<div flex class="mbpTable" ng-right-click="$mdOpenMenu($event)">{{tab.title}}</div>
<md-menu-content>
<md-menu-item>
<md-button ng-click="">Alert</md-button>
</md-menu-item>
</md-menu-content>
</md-menu>
As you can see, I defined a custom directive to make it show the menu on right click:
angular.module("ngRightClick",[]).directive('ngRightClick', function($parse) {
return function(scope, element, attrs) {
var fn = $parse(attrs.ngRightClick);
element.bind('contextmenu', function(event) {
scope.$apply(function() {
event.preventDefault();
fn(scope, {$event:event});
});
});
};
})
The problem is that menu appears always on the top left of the page, no matter where I click (consider that the previous HTML is inside a navbar with several options). How can I make$mdOpenMenu consider $event.clientX and $event.clientY values while opening the menu using the right click?
Thanks