[SalesForce] How to pass parent component Attribute values to Child Components when Lightning Application gets loaded initially

My Lightning Application Opens on click of a button from Opportunity.
Application has 1 Parent Component which holds 2 child components.
Now, When application gets loaded i am making external callout and getting JSON Response from Parent Components's init method (Calling Apex from JS Controller) and setting 2 attributes (1-1 Each for Child Component) on parent component.
So, Now i am passing relevant attribute to Child component and using this attribute value in it's init method. But problem is apex response from parent init is async in Lightning. And Hence i am not able to get this attribute value in child components init method, it is coming as null.

The reason why i am not calling apex from child is because that component is reusable and the response from external callout is not only for this components it contains lot other data to be used for other components.

Best Answer

Use a change handler.

For this attribute:

<aura:attribute name="something" type="String"/>

Define this handler:

<aura:handler name="change" value="{!v.something}" action="{!c.handleSomethingChange}"/>

That way, when you set the child attribute from the parent, your change handler will detect it and fire whatever logic you need.