+ Start a Discussion
Naval Sharma4Naval Sharma4 

Having trouble with Lightning component when I put a component in the div. It doesn't render the nested component.

Here is my code and according to me, there is nothing which can cause this issue. It does work when I don't use the div tag around the c:NestedComponent. 

MainComponent.cmp   
<aura:component controller="ContactClass" implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global" >
 <aura:attribute name="contact" type="Contact[]"/>
    <aura:handler name="init" value="{!this}" action="{!c.doInit}" />
    <aura:iteration items="{!v.contact}" var="con">
        <br/>
        <a href="javascript:void(0);" onclick="" role="tab" tabindex="0" aria-selected="true" aria-controls="tab-default-1" id="{!con.Id}">{!con.Name} | {!con.AccountId}</a>
  <div>
        <c:NestedComponent Cont="{!con}" />
  </div>
        
    </aura:iteration>
</aura:component>

MainComponent.js
({
    doInit: function(component, evt, helper) {
        var action = component.get("c.getContact");
        action.setCallback(this, function(a) {
                component.set("v.Contact", a.getReturnValue());
        });
        $A.enqueueAction(action);
        
    },  
}
})

NestedComponent.cmp
<aura:component controller="SBBQQUOTELIneClass" access="global" implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction">
    <aura:attribute name="Cont" type="Contact" default="{ 'sobjectType': 'Contact' }" access="global"/>
    <p>QUestion 1</p>
    <force:inputField aura:id="prId" value="{!v.Cont.AccountId}" class=""/>
    
</aura:component>

 
krisstannumkrisstannum
is Locker Service On or Off? I'm not really sure if it could cause that error though.