Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8217357
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T12:26:09+00:00 2026-06-07T12:26:09+00:00

Using node.js I am passing some variables to jade view: res.render(‘index’, { locals: {

  • 0

Using node.js I am passing some variables to jade view:

res.render('index', {
        locals: { 
                      name: user.name, 
                      hashpassword: JSON.stringify(user.hashPass), 
                      languages: JSON.stringify(langs)}
                });

In jade file I have:

body
    #heading
      h1 nodechat
      label !{locals.languages} // working - printing whole json string
    #content
      - var laangs = !{locals.languages} //not working here!
                   //SyntaxError: Unexpected token .

      - each item in laangs
        label= item.EnglishName

The problem is that I cannot pass locals.languages to a variable in jade file. If I assign it to a single html element (like label), it’s working, but when I try with var = that doesn’t work.

What may be the problem?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T12:26:11+00:00Added an answer on June 7, 2026 at 12:26 pm

    See my change below…

    body
        #heading
          h1 nodechat
          label !{locals.languages} // working - printing whole json string
        #content
          //- Do it like this...You're already in JavaScript land after the -
          - var laangs = locals.languages
          - each item in laangs
            label= item.EnglishName
    

    Change !{locals.languages} into locals.languages

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am parsing some XML using Nokogiri and XPath. When I do this: doc.xpath('//Order/child::node()').each
I'm using mongoose (on node) and I'm trying to add some additional fields to
I'm using jQuery with jsdom (0.2.10). For some reason node.exe (0.6.5.1) never returns when
I'm trying to write a Node.js module, using C++, that wraps and exposes some
When using node.js to e.g. serve requests for a backbone.js front end, would node.js
I'm (almost) successfully using Node.js with Express and Redis to handle sessions. The problem
I'm inserting documents using node mongodb native driver into a mongodb (sic!). My objects
I'm successfully using Node.js + Express + Everyauth ( https://github.com/abelmartin/Express-And-Everyauth/blob/master/app.js ) to login to
I am using Node.js (with Express.js) to pass a JSON data object from the
I'm interested in using Node.js as a socket server for stream-based communication with tens

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.