Trying to read currently clicked source's title using event.getSource().get("{!v.title}") and set it to the Event attribute. But it is showing me below error.

Action failed: c$AssignedAssessmentListItemToPatient$controller$fireatq [SyntaxError: Invalid key {!v.title}] Failing descriptor: {c$AssignedAssessmentListItemToPatient$controller$fireatq}. Please try again.

It was working fine before Summer 16 release. Please find below code:

fireatq : function(component, event, helper) {
   var action = $A.get("e.c:ATQEvent");
   action.setParams({"AssId" : event.getSource().get("{!v.title}")}
  • try get("v.title") instead of get("{!v.title}") – Praveen Jun 13 '16 at 9:51

Since Lightning Components Bundle version 39 or above, this seems to have been stable now.

If you have an event like onclick on an HTML tag like <div>, you can use event.currentTarget.

But if the event is for a Lightning Component tag like <lightning:button>, you need to use event.getSource().

This has been well documented in the Event Handling section of Lightning Components Developer guide.


I found that you can assign entire objects and then get them via event.currentTarget. Not sure how long is it going to work for, but works with LS in v40:

    variant="{! if(v.state.screen == 'view', 'brand', 'neutral') }"/>

toggleView: function(cmp, event, helper) {
  const view = event.currentTarget.name
  cmp.set('v.state.screen', view)



baz: function(cmp, event, helper) {

Unsure if this answers your question, but it's a nice and a useful pattern to use.

  • 1
    I think something has quietly changed and... it doesn't seem to work anymore. – dzh Jul 4 '17 at 23:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.