GithubHelp home page GithubHelp logo

pkdevbox / angular-context-menu Goto Github PK

View Code? Open in Web Editor NEW

This project forked from opf/angular-context-menu

0.0 3.0 0.0 156 KB

An AngularJS directive to set up and display a context menu when a (right-)click event is triggered.

Home Page: http://tilt.github.io/angular-context-menu/

License: MIT License

JavaScript 75.10% HTML 24.90%

angular-context-menu's Introduction

Angular-context-menu

An AngularJS directive to set up and open a context menu when a right-click or click event is triggered

Step 1: Install angular-context-menu

Install using Bower:

bower install angular-context-menu --save

Include angular-context-menu.js or angular-context-menu.min.js in your app.

Step 2: Load the ng-context-menu module

var app = angular.module('menu-demo', ['ngRoute', 'ng-context-menu'])

Step 3: Define the context-menu using the context menu factory to glue together a template and a controller

angular.module('myApp')

.factory('MyContextMenu', [
  'ngContextMenu',
  function(ngContextMenu) {

  return ngContextMenu({
    controller: 'MyContextMenuController',
    controllerAs: 'contextMenu',
    templateUrl: '/templates/my_context_menu.html'
  });
}])

.controller('MyContextMenuController', [
  '$scope',
  function($scope) {

  $scope.menuEntries = [];
}]);

You can explicitly set the container when setting up the context menu factory.

Step 4: Add a context-menu handler to a DOM element

<div has-context-menu
     class="panel panel-default"
     data-target="MyContextMenu"
     locals="some, properties"
  ...
</div>

You can list locals, which are properties from the scope of the element opening the menu, which will be forwarded to the context menu scope.

The context menu will get its coordinates by the position of the mouse when the context menu menu receives the (right-) click event.

A demo will be linked in a while.

Release

Please follow these steps to create a release for the Angular Context Menu:

  1. Increase the version number in bower.json
  2. Run gulp
  3. Commit the changes like done in this commit
  4. Create a release in GitHub (see the documentation for details)

angular-context-menu's People

Contributors

0xf013 avatar bitdeli-chef avatar busterbeans avatar coolweb avatar hschink avatar myabc avatar nickmessing avatar tilt avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.