Is it possible to have two aura:id
for one lightning component?
I am feeling that I have an x-y problem
, but I can not think any other solution her. So, let me explain the issue.
In a nutshell I have the following lightning app architecture:
Parent component(pc) has two child components (c1, c2). pc can have different components in place of c1 and c2. Sometimes c1 may dispatch a component event which pc should handle. pc should handle the event as follows: check that c2 has a specific component function if it does have it pc should call it.
In order to check for the function presence in c2 I need to access the component at first. I would like to use
aura:id
for that. But the thing is that components which may be in place of c2 may have differentaura:id
. So, I was hoping to add a secondaura:id
to c2 to extract whatever component there might be. In other words I would like to usaura:id
here as an interface in OOP.
If you have different propositions on how to solve that I would be glad to hear them. In case I did not provide some information ask me and I will provide it.