Say I have an ng-click event on an button
<button ng-click="callMe()" />
And in my AngularJS Controller I have something like
myApp.controller('myController', ['$scope', function ($scope)] {
$scope.callMe = function() {
console.log("call originated from...");
};
$scope.anotherMethod = function(){
$scope.callMe();
}
});
Can I tell from inside the callMe method where it was called from? i.e. did the user trigger it when clicking on the button or was it from the anotherMethod method?
Ideally, I'd like not to have to pass around additional variables inside my function calls. e.g.
callMe('fromClick')
Thanks
arguments.callee.caller, but it is officially deprecated and won't work in strict mode: jsfiddle.net/P24dY/1