I have an array like this:
var arr = ["element1","element2"];
and I would like to get the elements of it in a handlebars file.
I googled with no result the only solution what i found is this:
{{#each files}}
<a href="/"{{path}}"">{{title}}</a>
{{/each}}
But this is not good for me because I would like to achive that all of my files in a directory could be downloadable.
The code what I tried on the server side:
app.get('/download',function(req,res){
var items;
fs.readdir('./download',function(err,files){
items = files;
});
res.render('download',{
files:items
});
});
And I don't know how to iterate on the client side to make all of the elements in the array downloadable.
On the clien side I have an unordered list which will contain the links. The problem is, that I have no idea how to achive that.
The code on the clien side:
<div id="container">
<div class="highlight">
<img src="img/highlight.png"></img>
<p>A Click to download</p>
</div>
<ul>
<li class="RoundedAll"><a href="/">Back</a></li>
</ul>
<br />
<ul>
<!-- What should I put here? -->
</ul>
</div>
Thanks for answers.