Disable right click in Angular JS

0
=
0
+
0
No specific Bitcoin Bounty has been announced by author. Still, anyone could send Bitcoin Tips to those who provide a good answer.
2

Hi,

I need to disable right click on <a> tag. Is there any way how to do this?

Tags:

2 answers

2
=
1
=
$1.25
1 tip with total amount of 4.7 mBTC($1.25 USD) have been sent by alex

You can create new directive (in my case disable-right-click) and use following code:

HTML:

<a href="#" style="font-weight: normal;font-size: 11pt" ng-click="view()" **disable-right-click**>View Tag</a>

and JS code:

app.directive("disableRightClick", function () {
    return {
        restict: 'A',
        link: function (scope, el) {
            el.bind("contextmenu", function (e) {
                e.preventDefault();
            });
        }
    };
});
SEND BITCOIN TIPS
User rating:

Thank You!

2

But it still RightClickable when you on Developer mode (CTRL+SHIFT+I)

SEND BITCOIN TIPS
0

Too many commands? Learning new syntax?

FavScripts.com is a free tool to save your favorite scripts and commands, then quickly find and copy-paste your commands with just few clicks.

Boost your productivity with FavScripts.com!

Post Answer