function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Patrick McClellanPatrick McClellan 

setting attributes from nested components

I'm trying to understand how to communicate/ set attributes (variables) in nested components. Here's the situation:
Top level component: enterResult.cmp -- contains an aura:iterate that calls...
Second level component: topicItem.cmp.
I'm running a doInit handler in topicItemController.js, where I want to get an attibute from Top Level enterResult.cmp, add 1, then set an attribute in Second level component topicItem.cmp.

Any help, links to documentation, and/or examples would be appreciated. Thanks!
Best Answer chosen by Patrick McClellan
Alain CabonAlain Cabon
Hi Patrick,

The components can communicate with events (application and component events) and Attributes or Methods.

In the Lightning Component Framework (LCF), inter-component communication is supported in several well-defined ways. One can only use the following developer-defined interfaces to specify what can be exchanged:

Attributes or Methods to pass data down the component hierarchy
Lightning Events to pass data up and around in the component hierarchy

https://developer.salesforce.com/blogs/developer-relations/2017/04/lightning-inter-component-communication-patterns.html

Regards
Alain

All Answers

Alain CabonAlain Cabon
Hi Patrick,

The components can communicate with events (application and component events) and Attributes or Methods.

In the Lightning Component Framework (LCF), inter-component communication is supported in several well-defined ways. One can only use the following developer-defined interfaces to specify what can be exchanged:

Attributes or Methods to pass data down the component hierarchy
Lightning Events to pass data up and around in the component hierarchy

https://developer.salesforce.com/blogs/developer-relations/2017/04/lightning-inter-component-communication-patterns.html

Regards
Alain
This was selected as the best answer
Patrick McClellanPatrick McClellan
Thanks for the response and link! Much appreciated.
Alain CabonAlain Cabon
I have met Philippe Ozil in Paris during the Lightning Now European Tour in 2016. He was the French expert for Lightning during these days.

https://developer.salesforce.com/blogs/developer-relations/2016/05/meet-new-emea-developer-evangelists.html

https://developer.salesforce.com/blogs/developer-relations/2016/11/lightning-now-european-tour.html

Regards
David Roberts 4David Roberts 4
You also use a wrapper class. See: http://bobbuzzard.blogspot.co.uk/2015/12/lightning-component-wrapper-classes.html