Git Product home page Git Product logo

angular-right-click's Introduction

angular-right-click

Angular right click and context menu library. No dependencies.

Installation

General

  • Copy/move ng-right-click.js from src dir in the package to your project dir

  • In your Angular app, add a dependency to your module as below:

    angular.module('yourApp',['ngRightClick',...]');

bower

In your project dir, type the following command:

$ bower install angular-right-click

Then add a <script> in your project html:

<script src='/bower_components/angular-right-click/src/ng-right-click.js'></script>

And finally in your Angular app, add the dependency as:

angular.module('yourApp',['ngRightClick',...]');

npm

In your project dir, run the following command:

$ npm install angular-right-click

Then require() in your project source as:

require('angular-right-click')

CSS

Import default css file in your project index file as:

<link rel="stylesheet" href="[node_modules | bower_components]/angular-right-click/src/css/ng-right-click.css">

Usage

Basic callback only (like ng-click, no context menu)

<div ng-right-click="someFunction()"></div>

Context-menu only option

In your html file, use the component like this:

<div ng-right-click menu-items="menuItems"></div>

Both callback and context-menu option

<div ng-right-click="someFunction()" menu-items="menuItems"></div>

where the data format is (in your controller):

$scope.sayHello = function(){
    //say hello!
};

$scope.menuItems = [
      { text: "Menu Item 1", //menu option text
        disabled: true //No click event. Grayed out option.
      },
      {
        text:"Menu Item 2", 
        callback: sayHello, //function to be called on click 
        disabled: false
      }
    ];

Styling

I have included a default css file for default styling. Include it in your file. You can easily override it with your custom css class lie that:

<div ng-right-click menu-items="menuItems" menu-class="custom-css-class"></div>

Examples

Please check the examples directory to get the gist!

Check code example here.

angular-right-click's People

Contributors

gsenthilmca avatar shantanubhadoria avatar zeeshanhyder avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

angular-right-click's Issues

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.