Timeline for How to pass parameters from component and access them in js controller Lightning App
Current License: CC BY-SA 3.0
12 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Dec 15, 2015 at 4:10 | answer | added | Jim W | timeline score: 3 | |
Sep 21, 2015 at 21:45 | history | tweeted | twitter.com/#!/StackSalesforce/status/646077714227687424 | ||
Jun 30, 2015 at 15:41 | answer | added | zeo2396 | timeline score: 0 | |
May 19, 2015 at 18:08 | comment | added | Kris Gray | You certainly can't pass any parameters to a controller method, that's against the principles of the controller. You should be able to set them on the component, then act upon them in the controller based on what component fired the event. | |
May 19, 2015 at 7:46 | comment | added | ScoRpion | @Kris Gray Could you tell me how can i pass parameters on simple click on some DOM attribute, If i want to access the values say I have 10 images on my DOM dynamically created with different aura IDs, how could i know in my Js Controller, which image was clicked. and i would like to know is there a way i can pass n no. of parameters from my comp. to js controller onClick(). as in traditional programming we would pass as js function parameters or via HTTP POST or GET methods. | |
May 15, 2015 at 16:20 | comment | added | Kris Gray | Right the child component could throw an event that the parent handles. Our support for event delegation is weak at the moment. | |
May 15, 2015 at 10:03 | comment | added | pchittum |
I think if it is just the ID the getSource option might work. If you need more params, you may need to create your own special wrapper component with attributes that are set and then passed. The event handler would then be on the wrapper component, instead of this one. Sorry I don't have time to build out an example and show, but hopefully this comment sends you in the right direction.
|
|
May 14, 2015 at 21:32 | comment | added | Kris Gray | Try event.getSource(), see if that gets you the component you expect. | |
May 14, 2015 at 10:20 | history | edited | ScoRpion | CC BY-SA 3.0 |
added 2 characters in body
|
May 14, 2015 at 10:11 | history | edited | ScoRpion | CC BY-SA 3.0 |
added 586 characters in body
|
May 14, 2015 at 9:42 | comment | added | pchittum | Some example code would be helpful. | |
May 14, 2015 at 8:05 | history | asked | ScoRpion | CC BY-SA 3.0 |