项目作者: Krol22

项目描述 :
Angular 1.6 context menu module
高级语言: HTML
项目地址: git://github.com/Krol22/ngContextMenu.git
创建时间: 2017-03-14T20:13:16Z
项目社区:https://github.com/Krol22/ngContextMenu

开源协议:MIT License

下载


ngContextMenu

To use this component you can download it directly from repository (repository probably will have newest version of this component) or using node package manager :

  1. npm install angular-context-menu

Dependencies: JQuery 3.2, Angular 1.6 and font awesome css.

It can be used by adding script and css file to your html page.

Basic configuration

First you need to add module with component to angular module that will use angular-context-menu component:

  1. angular.module('application', ['ngContextMenu']);

And then you can use it in your html file:

  1. <button ng-context-menu="arrayOfItems">Right click on me!</button>

Example arrayOfItems (contains every type of menu item)

  1. var callback = function(){ }; // function launched only when clicked on normal item (not with submenu or disabled)
  2. var item = { name: "Menu option!", callback: callback },
  3. disabledItem = { name: "Disabled option :(", disabled: true },
  4. separatorItem = { separator: true },
  5. itemWithSubmenu = {
  6. name: "Submenu",
  7. submenu: [
  8. {
  9. name: "Sub option 1",
  10. icon: "fa-address",
  11. },{
  12. name: "Sub option 2",
  13. submenu: [
  14. {
  15. name: "Sub option 2.1",
  16. },
  17. {
  18. name: "Sub option 2.2"
  19. }
  20. ]
  21. },{
  22. name: "Sub option 3",
  23. },
  24. ]
  25. };
  26. $scope.arrayOfItems = [ item, disabledItem, sseparatorItem, itemWithSubmenu ];

Demo page