Answer the question
In order to leave comments, you need to log in
How to pass a condition to a JADE array?
Hey!
It was required to add an element in one place of an array. How can you do this with a condition?
Now there is a mixin:
+e('ul').list
each item in data.items
+e('li').item
+e.name
span #{item.title}
if item.tooltip == true
+b('a')(title='' href='javascript:void(0);').help.--characteristic ?
+e.text #{item.text}
- data = {"items": [{"title": "WI-FI", "text": "Есть", "tooltip": "true"}, {"title": "Разрешение камеры", "text": "8 Мпикс"}, {"title": "Материал корпуса", "text": "Металл"}]}
+characteristic-product('', ' ', data, '')
Answer the question
In order to leave comments, you need to log in
Found
+e('ul').list
each item in data.items
+e('li').item
+e.name
span #{item.title}
if item.tooltip == true
+b('a')(title='' href='javascript:void(0);').help.--characteristic ?
+e.text #{item.text}
- data = {"items": [{"title": "WI-FI", "text": "Есть", "tooltip": true}, {"title": "Разрешение камеры", "text": "8 Мпикс"}, {"title": "Материал корпуса", "text": "Металл"}]}
+characteristic-product('', ' ', data, '')
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question