How can we call child component controller method from the parent component controller method? : salesforce lightning component



How can we call child component controller method from the parent component controller method? : sal..

Answer / Sarvesh Siddharth

To call a child component's controller method within the parent component's controller, you can use the `$A` utility to find and invoke the desired method. Here's an example:

```javascript
// In Parent Component Controller
{!c.init}
function init() {
var childComponent = this.find('childComp'); // Assuming the child component's aura:id is 'childComp'
$A.enqueueAction(actionFunction);
function actionFunction() {
childComponent.callChildMethod(); // Calling child component's method
}
}
```

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Salesforce Interview Questions

Mention how many relationship is included in sfdc and what are they?

1 Answers  


How to update the record using after trigger context?

1 Answers  


Define sosl ?

1 Answers  


What is javascript remoting for apex controllers?

1 Answers  


If the workflow field update & trigger on the same set of attribute and action, will it fall under infinite loop?

1 Answers  


Is it possible to fire validation only for records which is being getting updated not to newly inserted records? : salesforce validation rules

1 Answers  


What is a static resource in salesforce?

1 Answers  


What may be reason truncate button is not visible on custom object?

1 Answers  


What are different types of reports? : salesforce reports and dashboards

1 Answers  


What is field dependency and how many can be used in a visualforce page?

1 Answers  


Explain Assignment process & validations.

1 Answers   Accenture,


What is aura? Why do we use the aura: namespace in the code ? : salesforce lightning component

1 Answers  


Categories