简体   繁体   中英

use boolean locals in pug

I use pug in nodejs and want to pass boolean locals to pug file and if conditions based on this local.

how can I use firstnameProblem on pug file in if condition like blow?

email.js:

email.send({
    template: template,
    message: { to: 'a@a.com' },
    locals: {firstnameProblem:false}
  });

html.pug:

 ul
      if ${firstnameProblem}
           li Problem in first name

I found my answer, I can use locals like variable in pug like blow:

html.pug:

ul
      if firstnameProblem
           li Problem in first name

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM