Let's say I have a directive with an incoming attribute of "contextMenuId."
In this directive I now perform:
contextMenu = $('[id*="' + iAttrs.contextMenuId+'"]');
or...
contextMenu = angular.element(document.querySelector('[id*="' + iAttrs.contextMenuId+'"]'))
If these don't do the same thing, I would love it if someone could tell me the difference, but that's separate from my answer.
Now, lets have a look at our contextMenu:
<ul id="exampleContextMenu" context-menu-defs="contextMenuDefs" ></ul>
I would like to access the array contextMenuDefs from the directive I mentioned earlier, yet this is from an entirely different scope that I do not have access to.
Can I somehow get access to the scope that contextMenu was compiled with from within my directive? Thanks!
You can use for get scope other element:
angular.element("<selector as jquery>")).scope();
In your situation:
var scopeOuther = angular.element('[id*="' + iAttrs.contextMenuId+'"]')).scope();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With