[SalesForce] Aura: init of child component executes before parent components init, alternate approach

I am new to Salesforce lightning, just started using aura tags.

I have to pass parameters to a component (Aura Table) inside parent component (no inheritance),
Unfortunately child component's init is being executed before Parent's.
Attribute 'query' is considered as undefined in child as the value was assigned later in parent's init.

Is there anyway I can make child component's init wait before parent init completes its part?

Also I tried creating Dynamic component in controller and adding to v.body,
Lost the Table style, No headers. Am I missing some thing.
Let me know if there is any other approach.

Parent Component

<aura:component controller="xyz" implements="force:appHostable">
  <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
  <aura:attribute name="query" type="String"/>
 <div>
     <c:childComponent queryParam="{!v.query}" />
 </div>
</aura:component>

Best Answer

In Component initialization child component Init event is fired before parent Init event.Use<aura:if> tag to check all required attributes before creating component.

<aura:component controller="xyz" implements="force:appHostable">
  <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
  <aura:attribute name="query" type="String"/>

  <aura:if isTrue="{!v.query}">
    <c:childComponent queryParam="{!v.query}" />
  </aura:if>
</aura:component>