Skip to content

Instantly share code, notes, and snippets.

@absqueued
Last active August 29, 2015 14:23
Show Gist options
  • Save absqueued/b88a1b1fd0e3f7e2270f to your computer and use it in GitHub Desktop.
Save absqueued/b88a1b1fd0e3f7e2270f to your computer and use it in GitHub Desktop.
Usage Sample for Angular JS Context Menu Directive
'use strict';
/**
* This Gist is code sample for blogpost:
* http://www.cssjunction.com/angularjs/custom-context-menu-directive/
*/
var app = angular.module('contextMenuApp')
.controller('MainCtrl', function ($scope) {
$scope.menus = [
{label: 'View', action: 'callView', active: true},
{label: 'Delete', action: 'deleteItem', active: true},
{label: 'Send', action: 'sendItem', active: false}
];
$scope.deleteItem = function(arg){
console.warn('deleted ...')
};
$scope.callView = function(arg){
console.info('View Call, another method')
};
});
}]);
<section ng-app="contextMenuApp">
<div ng-controller="MainCtrl">
<button
context-menu
menu-items="menus"
pointer-node=".showHere">
Show Options
<span class="showHere">&gt;</span>
</button>
</div>
</section>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment