title: Passing values back to be rendered by Jade, using Express and Node
body: <p>I asked a question yesterday, but I've kept going with it.  Instead of calling next() and passing an an Error object, I worked out what it was doing, and tried to copy it.  Now, when someone logs in and it fails, I do this:</p>
  
  <pre><code>   res.render("pages/home", 
              {
                  flash:{"danger":["Login failed. Please enter your details and try again."]},
                  body:{},
                  section:"home",
                  locals : { userId : req.body.email } 
              }
  </code></pre>
  
  <p>This does exactly the same thing as the old code.  I step through it, and I can see that the locals object contains a property called userId, with the value I expect.  In the Jade template, I have this:</p>
  
  <pre><code>    p it's #{typeof(userId)}
      if(typeof(userId) != 'undefined')
          p Welcome #{userId}
          input(type='text', name='email', id="inputEmail", placeholder="Email", value="#{userId}")
      else
          input(type='text', name='email', id="inputEmail", placeholder="Email", value="")
  </code></pre>
  
  <p>This always renders as 'it's undefined' and then an empty text box.  I have read several questions on this, and as far as I can see, they all say the same thing: if I set locals to be a JSON object, I can access it's properties by this syntax, but it does not work.  </p>
  
  <p>What am I doing wrong ?</p>