Answer the question
In order to leave comments, you need to log in
Express Handle Bars. How can I get only 1 element from the database in index.hbs?
Good afternoon. Sorry in advance for the wrong question. I am new to node.js in general. The essence of the question is that I need to pull out only 1 element of the array from the database.
Here is the source. The database outputs everything fine with this. Syntax issues.
<h3>Index page</h3>
{{#each items}}
<ul class="table">
<li>ID = {{id}}</li>
<li>Title = {{title}}</li>
<img src="{{img}}" alt="">
<li>Price = {{price}}</li>
<li>Type = {{type}}</li>
<li>Chance = {{chance}}</li>
</ul>
{{/each}}
<h3>Index page</h3>
{{#each items}}
<ul class="table">
<li>ID = {{id[5]}}</li>
<li>Title = {{title[5]}}</li>
<img src="{{img[5]}}" alt="">
<li>Price = {{price[5]}}</li>
<li>Type = {{type[5]}}</li>
<li>Chance = {{chance[5]}}</li>
</ul>
{{/each}}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question