Sindico Sindico - 1 month ago 27
Node.js Question

Pug - generating Select and Options

I am new to Pug and I am trying to generate a Select set of Options like this:

select
each variable in variables
option(value=variable.id) #{variable.var_name}


However the result I get, in the rendered page, is an empty select input followed by the list of options as text

Answer

Indents the code https://pugjs.org/language/iteration.html

select
  each variable in variables
    option(value=variable.id) #{variable.var_name}
Comments