I have a list of outerItems. Inside each outerItem, I have a list of innerItems. They are dynamically sorted.
When mouse cursor points at one of innerItems, I have to show the popup window right above that innerItem element.
Popup div is body's child, because I do not want to have a separate popup for each of innerItems.
The way as I see it — on ng-mouseover
I call the function that sets left/top properties to my absolutely positioned popup. So for each of innerItems I'd like to call jQuery .offset()
method that gives me left/top values from the top-left corner of page.
So how can I get jQuery object of current scope element? Or, if I've chosen the wrong way
scope(); $('#elementId'). scope(). $apply(); Another easy way to access a DOM element from the console (as jm mentioned) is to click on it in the 'elements' tab, and it automatically gets stored as $0 .
AngularJS Scope The scope is the binding part between the HTML (view) and the JavaScript (controller). The scope is an object with the available properties and methods. The scope is available for both the view and the controller.
The angular. element() Function in AngularJS is used to initialize DOM element or HTML string as an jQuery element. If jQuery is available angular. element can be either used as an alias for jQuery function or it can be used as a function to wrap the element or string in Angular's jqlite.
Scope in a Directive Well, all of the directives have a scope associated with them. This scope object is used for accessing the variables and functions defined in the AngularJS controllers, and the controller and link functions of the directive.
In controller:
function innerItem($scope, $element){ var jQueryInnerItem = $($element); }
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