Loop through object properties nunjucks

前端 未结 2 1382
广开言路
广开言路 2021-02-13 12:40

I\'ve got following model:

items: {
    someId1: 
        {
            property1....
        },
    someId2: {...},
    someIdN: {...}
}

I wou

2条回答
  •  梦谈多话
    2021-02-13 13:10

    You can use nested loops like this:

      {% for item in items %} {% for something in item.someId1 %}
    • {{ something.property1 }}
    • {% endfor %} {% endfor %}

    For this json object:

    items: {
      someId1: {
        property1: "It makes you want to shout! Raise your hands up and..."
      },
      someId2: {...},
      someIdN: {...}
    }
    

提交回复
热议问题