The expense tracker app from the Lightning Components Developer's Guide shows the following markup for initializing an sObject attribute.
<aura:attribute name="newExpense" type="namespace.Expense__c"
default="{
'sobjectType': 'namespace__Expense__c',
'Name': '',
'namespace__Amount__c': 0,
'namespace__Client__c': '',
'namespace__Date__c': '',
'namespace__Reimbursed__c': false
}"/>
Is there a better way to initialize an sObject attribute like newExpense? Specifically, a way to initialize the attribute without manually having to explicitly initialize every single field which will be taking user input?
In Visualforce, all I had to do was construct a new sObject, such as Lead theLead = new Lead();
and then return that object via a property. I'm hoping there a similarly simple approach I can apply to initializing attributes in Lightning.