I am in a directive. Specifically https://github.com/wix/angular-tree-control/blob/master/angular-tree-control.js. It's a recursive directive as the name might suggest; it associates data with child scope. In this particular directive, it is really just element == scope. They pass the scope around to a bunch of functions and I was hoping to be able to manipulate the associated element node in the same function.
Tue, Mar 4, 2014 at 1:40 AM, Luke Kende <[email protected]> wrote: > $scope is not associated with just one element if it's in a controller, > and if you were using a directive, I do not think you would ask this > question. No, I don't believe there's a way to access a reference to an > element from a controller's $scope. > > This sounds like bad practice. What is it you are trying to accomplish > that you believe you need an element reference from scope? > > > On Monday, March 3, 2014 11:41:17 AM UTC-7, Matt Hughes wrote: >> >> You can get the scope associated with a given DOM element via: >> >> angular.element(foo).scope(). >> >> Are you able to do the reverse? I have the scope, but I want the element >> associated with it. >> > -- > You received this message because you are subscribed to a topic in the > Google Groups "AngularJS" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/angular/YIU9uby5TuE/unsubscribe. > To unsubscribe from this group and all its topics, 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/groups/opt_out. > -- 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/groups/opt_out.
