I am using a wrapper class so as not to have a glut of aura:attributes (this may be the problem in and of itself). I have a previous lightning component that has about 16 attributes and passing them all through as method parameters was messing (there is probably a better way of doing that). Here is a more basic example:


public class CreditAppWrapper {
    @AuraEnabled Credit_Application__c creditApp {get;set;}
    @AuraEnabled Business__c business {get;set;}
    @AuraEnabled Vehicle__c equipment {get;set;}
    @AuraEnabled List<Applicant__c> principals {get;set;}


 <aura:attribute name="cApp" type="CreditAppWrapper"/>
<lightning:input type="String" label="NAME" value ="{!v.cApp.Business.Name}"/>  



This logs null as the value

Is this because I can't have multiple levels on the input (ie. cApp & Business & Name)? Do I need to instantiate the wrapper class first?


I'm new to lightning, but two things I see:

  • The type name in your component isn't matching the class name: 'AppWrapper' versus 'CreditAppWrapper'
  • The properties you are exposing aren't primitive types, so yes, they'd need to instantiated.
  • Thanks Corey. Yeah, the "AppWrapper" vs "CreditAppWrapper" was a typo when entering it. I figured the instantiating was the issue, but whenever I try to use the default attribute, it breaks a lot of things. Perhpas I will try from my init function.
    – awh01
    Feb 26 '19 at 17:45
  • Yeah, just instantiating it within my init function did the trick. Thank you, Corey
    – awh01
    Feb 26 '19 at 17:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.