Last active
August 29, 2015 14:23
-
-
Save absqueued/b88a1b1fd0e3f7e2270f to your computer and use it in GitHub Desktop.
Usage Sample for Angular JS Context Menu Directive
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'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') | |
}; | |
}); | |
}]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<section ng-app="contextMenuApp"> | |
<div ng-controller="MainCtrl"> | |
<button | |
context-menu | |
menu-items="menus" | |
pointer-node=".showHere"> | |
Show Options | |
<span class="showHere">></span> | |
</button> | |
</div> | |
</section> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment