I am dynamically creating HTML <div>
and I need to handle the onclick event : when the user clicks on it, I want to call a controller function and this function requires an argument. How do I pass an argument to a reference function ?
Here is my code
$A.createComponent(
"aura:html",
{
tag: "div",
HTMLAttributes: {
"class": "prestationBlock",
// here I pass a reference to my controller function... How do I pass
// an argument to this function ?
"onclick": component.getReference("c.onPrestationClick")
}
},
// called when the element is created
function(div)
{
// ...
}
);
<div>
. Each created element has a different prestationID, I need the onclick to take into account this specific data and execute an action accordingly. This is why I'm looking for a way to pass an argument to the controller function – metheM Mar 15 '19 at 10:39