Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
146
rated 0 times [  152] [ 6]  / answers: 1 / hits: 16537  / 9 Years ago, mon, may 25, 2015, 12:00:00

I have template which starts like :



<li class=list-group-item ng-repeat=question in question.ChildQuestions collapse-toggler ng-click=collapseQuestion(this);> ...


In collapseQuestion i want to pass object that will be reffered to clicked li, but when i send it like collapseQuestion(this); i get some Object but it seems like it isn't li (i can't get any class of that object to check what exactly it is).



So what is correct way to pass object in ng-click ?


More From » jquery

 Answers
3

You need to parse the event itself.



ng-click=collapseQuestion($event);


Then in the function use $event.currentTarget



function collapseQuestion($event) {
$event.currentTarget //do something with currentTarget
}


This post maybe of use: get original element from ng-click


[#66482] Thursday, May 21, 2015, 9 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
jayla

Total Points: 14
Total Questions: 96
Total Answers: 123

Location: Greenland
Member since Fri, Jul 31, 2020
4 Years ago
jayla questions
;