I am new to AngularJS and exploring event handlers. I am going over an existing code base and had no idea why $event is being passed. This is what the html looks like
<p><a ng-click="packBtnClick($event)" href="#" title="">[[btnAction]]</a></p> And in the controller,
$scope.packBtnClick = function($e){ $e.preventDefault(); if($scope.packAvailable){ addPackIntoCart(); } else{ //some other code. }; The only purpose of passing in an event here is to preventDefault behavior.
My question is - is it really necessary to pass in the $event?