Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

157
Views
Cómo pasar información de un controlador a una vista parcial

Tengo un problema con express y no se como solucionarlo. Me gustaría poder pasar información del controlador a una vista parcial (un encabezado). El problema es que cuando accedo a una vista diferente a la que renderizo en el controlador, se rompe. ¿Cómo puedo pasar información a una vista y hacer que funcione en todas ellas?

 const indexController = (req, res) => { let emailSession; if(req.session.userLogged == undefined){ emailSession = ""; } else { emailSession = req.session.userLogged.email } db.Users.findOne({ where: {email: emailSession} }).then((data) => { res.render('index', {data}) //I want here to send the same variable to all of my views that has the same header, not just the index view ) }
 <nav> <% if(data.info == "something") {%> <a href="">Dashboard</a> <% } %> </nav>

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!