sindresorhus / gulp-template

Render/precompile Lodash templates
MIT License
289 stars 77 forks source link

Can you tell me how can I loop this in this template? #47

Closed cruel32 closed 6 years ago

cruel32 commented 6 years ago

-json

{
    "name" : "csh",
    "eachTest" : [
        {"value":1},
        {"value":2},
        {"value":3},
        {"value":4}
    ]
}

-html

<body>
 <%= name %> <!-- this output is correct-->
 <%= eachTest %> <!-- this output is not what you want. No loop. --> 
</body>

__

kevinchappell commented 6 years ago

For anyone else that finds this closed issue without resolution:

<ul>
<% _.forEach(eachTest, function(test) { %>
  <li><%- test.value %></li>
<% }); %>
</ul>