I am using meteor. I have a template which looks like this,
<template name="SearchAct">
{{#each SearchPerson}}
<div class="result"><!--This is one search result box-->
<div class="resultContent">
<img src={{payload.pic_square}} alt="profile photo" class="floatLeft" />
<p>{{payload.uid}}</p>
<span class="floatLeft">
{{payload.first_name}}
<br/>
{{payload.last_name}}
</span>
<input type="checkbox" class="floatRight" />
<h4>Tennis</h4>
<span class="age_location">
{{#if payload.birthday}}
{{payload.birthday}},
{{/if}}
{{#if payload.sex}}
{{payload.sex}}
{{/if}}
<br/>
{{#if payload.hometown_location}}
{{payload.hometown_location.city}},
{{payload.hometown_location.state}},
{{payload.hometown_location.country}}
{{/if}}
</span>
<div class="line"></div>
<a href="#" class="clear" onclick="renderProfile({{payload.uid}});">See Their Details</a>
</div><!-- End of resultContent-->
</div><!-- End of result box-->
{{/each}}
</template>
Now I want to check a null value for {{payload.birthday}}
. Here if I get null
value, I want to display a message. How could I check a null
value?
I think you just need an {{else}}
in there:
<span class="age_location">
{{#if payload.birthday}}
{{payload.birthday}}
{{else}}
No birthday found
{{/if}}
</span>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With