I am not sure why this is not working. I have an aura:if condition, if the check matches then the item should be displayed. Here in this code below I am checking the ofc.agentName is not empty then the item should be shown. Plz advise!

<aura:if isTrue="{! notequals(ofc.agentName, ' ')}">
   <li class="slds-p-left_xx-small slds-p-left_xxx-small">{! ofc.agentName }<Strong><i >Name Not Matched</i></Strong></li>

notequals(ofc.agentName, ' ') compares the value to a single space character, ' '. To check if the value is empty, use the empty() function:


This will evaluate to true if the value is anything other than undefined, null, the empty array, and the empty string. (Note that it doesn't check for strings composed only of whitespace, though).

| improve this answer | |
  • 1
    +1,Propably !!empty(ofc.agentName) for negation! – codeyinthecloud Dec 19 '18 at 21:49
  • 1
    Well, "{! !empty() }" – David Reed Dec 19 '18 at 21:50
  • Agreed! OP was looking for negation so, just saying. Thanks – codeyinthecloud Dec 19 '18 at 21:51
  • Right but I think one ! is the use case here, no? He wants "not equal to blank" => !empty() – David Reed Dec 19 '18 at 21:52
  • Or am I looking at it sideways again? – David Reed Dec 19 '18 at 21:52

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.