<aura:attribute name="guid" type="String" default="{!v.simpleRecord.Loan_Guid__c}"/>
<aura:attribute name="fileCreated" type="Boolean" default="{!v.guid != '' ? true : false}"/>
guid--{!v.guid}--
I have this bit of code which is supposed to set the "fileCreated" boolean based on where or not the object has a guid. the v.guid is getting set correctly but for some reason my conditional doesn't seem to recognize an empty value.
!v.guid is never equal to '' even when the field is blank. If i do something like v.guid == "hello" and set the field to hello it will recognize that string but it cannot recognize an empty field. In the bi tabove wher ei print the guid guid–{!v.guid}–, it will print the guid and print guid— when the guid is empty.
Best Answer
Use
empty
to determine if something is empty (or, in this case, not empty):However, I'm not sure you can do all this with the "default" attribute, since it's not meant to be used this way. The documentation says:
If you choose do to what you're doing, you're venturing in to undefined-behavior territory.