Lightning Components: can aura:id be set to an component attribute?

I know it was never possible in Visualforce, but I wonder if it might be possible now in Lightning Components to have an aura:id not hardcoded but bound on an element like:

 <div aura:id="{!v.whatever}" /> 

Answer

The alternative to this is to dynamically create the component using $A.createComponent and since attribute is accessible via the JavaScript one can assign dynamic values to aura:I’d

Currently the expression syntax is not supported in the aura:id attribute

Attribution
Source : Link , Question Author : Uwe Heim , Answer Author : Mohith Shrivastava

Leave a Comment