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..." :/

3
  • Use directive instead of jquery. This can help you stackoverflow.com/questions/15731634/… Commented Aug 27, 2015 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? Commented Aug 27, 2015 at 18:19
  • for angularjs, it's inside of the controller, on the link there is this code: ng-click="link_clicked()" Commented Aug 27, 2015 at 18:47

1 Answer 1

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);
    };
}]);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.