S
S
s-morello2019-08-19 17:42:11
Pug
s-morello, 2019-08-19 17:42:11

How to output data from array in pug loop?

var list = [{
                class: [ 'items'],
                desc: 'items 1'
            },
            {
                class: [ 'items'],
                desc: 'items 2'
            },
            {
                class: [ 'items'],
                desc: 'items 3'
            },
            {
                class: [ 'items', 'active'],
                desc: 'items 4'
            },
            {
                class: [ 'items'],
                desc: 'items 5'
            },
            {
                class: [ 'items'],
                desc: 'items 6'
            }]

        ul
            each item in list
                li(class=list.class)= list.desc

Answer the question

In order to leave comments, you need to log in

1 answer(s)
0
0xD34F, 2019-08-19
@s-morello

Instead
it should be
li(class=item.class)= item.desc

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question