On the main scope, I have a ng-repeat running.
<table class="datatable" prevent-right-click visible="isVisible">
<tr ng-repeat="t in templateData">
<td confusedFunction="clickedonname(t)">{{t.templateName}}</td>
<td>{{t.templatePath}}</td>
</tr>
</table>
The prevent-right-click is a custom contextmenu which has a comment box in it, which takes comments on the respective right click element on the first td element. Is there anyway I can write a function which takes the repeated element, and passes in the directive, so that the comment can be recorded on the respective element? Also, the prevent-right-click has an isolated scope.
This is how my directive code is.
app.directive('preventRightClick', function() {
return {
restrict: 'A',
scope: {
visible: '='
},
link: function($scope, $ele) {
$ele.on('contextmenu', '*', function(e) {
e.preventDefault();
$scope.$apply(function () {
$scope.visible = true;
$('.parented').css({right:50, top:50}).show();
})
e.stopPropagation();
});
$(document).on('click', '*', function (e) {
if ($(e.target).parents('.parented').length > 0) {
}
else{
$('.parented').hide()
$ele.off('contextmenu', '*', function(){
console.log('Context menu off')
})
}
})
$scope.confusedFunction = function(t){
console.log(t.templateName)
console.log('coming from clickedonname')
}
}
};
})