Answer the question
In order to leave comments, you need to log in
How to sort elements by lists in jade?
I have this array of objects:
categories: [{
link: "#cat1",
name: "Категория1",
},{
link: "#cat2",
name: "Категория2",
},{
link: "#cat3",
name: "Категория3",
},{
link: "#cat4",
name: "Категория4",
},{
link: "#cat5",
name: "Категория5",
},{
link: "#cat6",
name: "Категория6",
},{
link: "#cat7",
name: "Категория7",
},{
link: "#cat8",
name: "Категория8",
},{
link: "#cat9",
name: "Категория9",
}]
Answer the question
In order to leave comments, you need to log in
Nobody is stopping you from using javascript
- var data = {categories: [{ link: "#cat1", name: "Категория1", },{ link: "#cat2", name: "Категория2", },{ link: "#cat3", name: "Категория3", },{ link: "#cat4", name: "Категория4", },{ link: "#cat5", name: "Категория5", },{ link: "#cat6", name: "Категория6", },{ link: "#cat7", name: "Категория7", },{ link: "#cat8", name: "Категория8", },{ link: "#cat9", name: "Категория9" }]};
- var categories;
- while (data.categories.length > 0)
- categories = data.categories.splice(0,4);
ul
each category in categories
li: a(href=category.link)= category.name
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question