Implementing ng-click

43 views
Skip to first unread message

mark goldin

unread,
Oct 31, 2014, 3:58:19 PM10/31/14
to ang...@googlegroups.com
I m trying to implement a click and have code acting upon.
My question is - how can I access the clicked object in my click handler? So far all I am getting is an html element or something. But I need a reference to an object. Like if a grid was clicked then I need to access its selected value and so forth.


Thanks for help.

Justin Walsh

unread,
Nov 1, 2014, 1:32:42 AM11/1/14
to ang...@googlegroups.com
Hi Mark, 

How about using the $target of the event?


Regards
Justin

mark goldin

unread,
Nov 1, 2014, 4:49:04 AM11/1/14
to ang...@googlegroups.com
Using that approach can you get a width of a clicked object or any other property?

Thanks

--
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/N02VQDzVGGM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to angular+u...@googlegroups.com.
To post to this group, send email to ang...@googlegroups.com.
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Justin Walsh

unread,
Nov 2, 2014, 1:42:37 AM11/2/14
to ang...@googlegroups.com
Apologies, I actually meant:

How about using the target of the $event?

The $event is just a handle on the DOM event.  There is a wealth of information available on this object, including information on the target.

Regards
Justin 

Eric Eslinger

unread,
Nov 2, 2014, 11:16:37 AM11/2/14
to ang...@googlegroups.com
Personally, I just do stuff like ng-repeat="item in itemlist" ng-click="rowClicked(item)", which will call rowClicked with the particular item from ng-repeat, which is what I think you're asking for.

e

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 angular+u...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages