2

I need to perform different behavior based on whether a String array flow attributes has been set or not. And need to differentiate between an empty array and between null value, however it seems lightning initializes these attributes! Anyone know how to default these values to null?

Unexpectedly initialized to empty string:

<aura:attribute name="listNoDefault" type="List" access="public"/>
<aura:attribute name="listNullDefault" type="List" access="public" default="null"/>
<aura:attribute name="stringArrayNoDefault" type="String[]" access="public"/>
<aura:attribute name="stringArrayNullDefault" type="String[]" access="public" default="null"/>    

Not initialized default is null!

<aura:attribute name="objectNoDefault" type="Object" access="public"/>
1

Maybe you can try assigning default values to these attributes during onInit method handler

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.