When hitting my sign-up page my jade template (with Twitter Bootstrap) is producing an empty error div (i.e. a red, opaque box with a closing link and no errors), despite the errors object returning typeof as 'undefined'. I've used this post for guidance on checking the value of errors. The code follows:
The controller:
/**
* Show sign up form
*/
exports.signup = function(req, res) {
res.render('users/signup', {
title: 'Sign up',
user: new User()
});
};
The Jade template:
extends ../layouts/default
block content
.row
//-.offset1.span5
.span6
a(href="/auth/facebook")
img(src="/img/icons/facebook.png")
//- a(href="/auth/github")
//- img(src="/img/icons/github.png")
a(href="/auth/twitter")
img(src="/img/icons/twitter.png")
a(href="/auth/google")
img(src="/img/icons/google.png")
.span6
if (typeof errors != 'undefined') // The following alert shouldn't be rendered
.fade.in.alert.alert-block.alert-error
a.close(data-dismiss="alert", href="javascript:void(0)") x
ul
each error in errors
//- li= error.param
li= error.msg
block auth
I've tried the following, but get the same result every time:
if (typeof errors != 'undefined')
if (typeof errors !== 'undefined')
if (typeof errors != undefined)
if (typeof errors !== undefined)
if (null != errors)
if (null !== errors)