myApp.directive('ngRightClick', function ($parse) {
return function (scope, element, attrs) {
var fn = $parse(attrs.ngRightClick);
element.bind('contextmenu', function (event) {
scope.$apply(function () {
event.preventDefault();
fn(scope, { $event: event });
console.log(event)
});
});
};
});
I have a directive that I found online as an example for right clicks. I
also have a treeview directive, and it uses a template.
var template = '<ul ng-right-click="theclick(this)">' +
'<li data-ng-repeat="node in ' + treeModel + '">' +
Depending on my nesting, i could have lets say 5 levels of folders.
1
----2
--------3
------------4
----------------5
1.2
-----1.3
Lets say i click on 4.
For some reason the console.log returns 4, 3, 2 and 1.
I am unsure on how not make it iterate through every single parent node.
Any tips greatly appreciated!
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.