How to set default values to variable in Salesforce lightning component?

How to set default values to variable in Salesforce lightning component?

Sample Code:


Component:

<aura:component >
    <aura:attribute name=”newItem” type=”Camping_Item__c”
    default=”{ ‘sobjectType’: ‘Camping_Item__c’,
                    ‘Price__c’: 0,
                    ‘Quantity__c’: 0}”/>
</aura:component>

Cheers!!!

Leave a Reply