3

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 ?

2 Answers 2

1

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

Sign up to request clarification or add additional context in comments.

Comments

1
ng-click="collapseQuestion(question)"

see How I pass an object as a parameter in a ng-click within a ng-repeat? AngularJS

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.