Answer the question
In order to leave comments, you need to log in
How to iterate json array in jade?
I'm building a simple static site, the assembler is gulp, the statics are in jade, there is data that is convenient to store in json.
Created the following construct in jade:
ol
each question in questions
li=question.q
each val in question.answers
label=val
input(type="radio")
span=question.current
span К сожалению, неправильный ответ. Пожалуйста, ознакомьтесь с информацией по вопросу здесь:
a(href=question.checkLink, target="_blank")=question.checkLink
{
"questions":{
"question":{
"q" : "some question 1",
"answers" : ["Ответ первый", "Ответ второй", "Ответ третий", "Ответ четвертый"],
"current" : 3,
"checkLink" : "http://test.test/"
},
"question":{
"q" : "some question 2",
"answers" : ["Ответ первый", "Ответ второй", "Ответ третий", "Ответ четвертый"],
"current" : 3,
"checkLink" : "http://test.test/"
},
"question":{
"q" : "some question 3",
"answers" : ["Ответ первый", "Ответ второй", "Ответ третий", "Ответ четвертый"],
"current" : 3,
"checkLink" : "http://test.test/"
}
}
}
Answer the question
In order to leave comments, you need to log in
{
"questions" : [
{
"q": "",
....
},
{
"q": "",
....
},
...
]
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question