第二个如果玉器布局中的语句不起作用

时间:2015-05-06 18:40:05

标签: node.js mongodb

第一个if语句正确触发并在值为true时将复选框标记为已选中,但第二个isn不是。

- var profileVal = false
- var logbookVal = false 

div.form-group.col-md-6
            -if(user.profilePublic){
                - profileVal = true
            -}
            label Public profile
            p Would you like your profile to be public?
            input(type='checkbox',name='userPublicProfile',class='floatLeftCheckbox',checked=profileVal)
        div.form-group.col-md-6.clearfix
            label Public logbook
            p Would you like your logbook to be public?
            -if(user.logPublic){
                - logbookVal = true
            -}
            input(type='checkbox',name='userPublicLogbook',class='floatLeftCheckbox',checked=logbookVal)

在mongoDB中,两者都设置为Boolean。两者都拼写正确等等。

console.log的结果:

deserializing user: { _id: 5547e77928d405cc236d4a01,
updated_at: 'Mon May 04 2015 17:41:13 GMT-0400 (EDT)',
created_at: 'Mon May 04 2015 17:41:13 GMT-0400 (EDT)',
admin: false,
lastName: '######',
firstName: '######',
email: '######',
password: '######',
callsign: '######',
uid: '$2a$10$/yF1pqR9N5VkXcnLaNDPBea8xH.tO3Tto82W.9wGD3VdZGPAdXID6',
profilePublic: true,
logPublic: true,
__v: 0 }

也尝试过:

-if(user.logPublic)
    p It's true

仍然没有

0 个答案:

没有答案