I have this:
<div class="col-md-2 col-md-offset-1 team" ng-mouseover="showDetails()" >
....
....
....
</div>
I want to pass the whole section of where the mouse is over to an angularjs function so then I will find each child.
$scope.showDetails = function(item){
console.log(item);
var element = $(item).find('#child1');
}
I tried showDetails(this) and showDetails($this) and showDetails({{this}}) but they dont seem to work. The first one print some stuff on the console but maybe something wrong since it cannot find the child1. What I am doing wrong?
a {$id: "004", this: a, $$listeners: Object, $$listenerCount: Object, $parent: a…}
You can access it through $event.target
.
<div class="col-md-2 col-md-offset-1 team" ng-mouseover="showDetails($event)" >
....
</div>
$scope.showDetails = function(evt){
console.log(evt.target);
var element = $(evt.target).find('#child1');
}
This probably means you are wanting to manipulate elements in your controller, this is a no-no. You should make a custom directive with your desired functionality.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.