I've got a mixin causing me trouble:
mixin dialog(title, description, choices)
form.choices.dialog.row
legend
h1 #{title}
p.description #{description}
fieldset
for choice in choices
label
input(type= "radio", name = "choice.name", checked = "checked", required = "required")
| choice.name
div.row.form-actions
button(type="submit", ) Make Choice
To call it, I first include the mixin file with this mixin:
import dialog
Then I use the mixin, after creating a javascript variable:
- var investiageUFODialog = [{headerText: "Would you like to investiage the UFO?", description: "Choose whether or not to investigate the UFO."}, {choices: [{name: "Yes"}, {name: "No"}]}]
mixin dialog(investiageUFODialog.headerText, investiageUFODialog.description, investiageUFODialog.choices)
What am I doing wrong?
investiageUFODialog can't be an array if you want to use it like that. Just change it to:
- var investiageUFODialog = {headerText: "Would you like to investiage the UFO?", description: "Choose whether or not to investigate the UFO.", choices: [{name: "Yes"}, {name: "No"}]}
Also, in your mixin, you need to write name = choice.name (without the quotes).