A
A
AlexMark2017-08-05 12:27:37
MongoDB
AlexMark, 2017-08-05 12:27:37

Why does handlebars return true?

{{#if user.facebook}}
  {{json user}}
<div style="width:100%; padding:15px; color:#000;" class="facebook-container">
  <span>Name</span> - {{user.facebook.name}}
  <span>Email</span> - {{user.facebook.email}}
</div>
{{/if}}

User in mongodb:
_id:596bb169055b0b1108ead07e
salt:"7982fee8246004be38d72d1468160895879865a1c2b7e6824f25ca606c84428d"
hash: somehash
email:"[email protected]"
name:"me"
__v:0

json :
{
 "_id": "596bb169055b0b1108ead07e",
 "email": "[email protected]",
 "name": "me",
 "__v": 0
}

Why does handlebars skip me if user doesn't have facebook field?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
de1m, 2017-08-06
@de1m

maybe because of this check?
{{#if user.facebook}}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question