0

I tried this modified version of jquery function:

$scope.link_clicked = function(e) {
    if (e.button == 0) {
        $("#spinner_bg").css("display", "block");
    }
};

But it gives error: "Cannot read property 'button' of undefined..." :/

yodalr
  • 9,778
  • 10
  • 32
  • 47
  • Use directive instead of jquery. This can help you http://stackoverflow.com/questions/15731634/how-do-i-handle-right-click-events-in-angular-js – Mudasser Ajaz Aug 27 '15 at 18:16
  • There's not enough code here to help. Show us where you set this function as the event listener. Also, are you looking for angular help, or jQuery help? – HankScorpio Aug 27 '15 at 18:19
  • for angularjs, it's inside of the controller, on the link there is this code: ng-click="link_clicked()" – yodalr Aug 27 '15 at 18:47

1 Answers1

1

You need to pass in the $event object: ng-click=link_clicked($event) like JSFiddle.

The JS code:

angular.module('Joy', [])
.controller('JoyCtrl', ['$scope', function ($scope) {
    $scope.link_clicked  = function (e) {
        console.log(e);
    };
}]);
Joy
  • 9,430
  • 11
  • 44
  • 95