I am in need of a customized click directive that can execute the passed code using scope.$apply().
$(elem).on('click', function(){
scope.$apply(attrs.wdClick);
});
Everything works smoothly when I pass something like wd-click="something = !something". However, I encountered an issue when trying to call a $rootScope function - it didn't work. Surprisingly, the default ng-click worked perfectly fine.
wd-click="$root.someFunction()" //the function doesn't get called but ng-click does
I attempted to update the directive to solve this problem:
$(elem).on('click', function(){
$rootScope.$apply(attrs.wdClick);
});
Unfortunately, even after making this change, the issue persists. Any suggestions?