Reputation: 115
I tried to use the package "express-flash" for NodeJS with Handlebars, all is good but I can not loop over "messages.errors". This is the code of my view "flash.hbs':
{{#if messages.errors}}
<div class="alert alert-danger" role="alert">
<button class="close" type="button" data-dismiss="alert">
<i class="fa fa-times"></i>
</button>
{{#forEach messages.errors}} {{ errors }} {{/forEach}}
</div>
{{/if}}
The div it's empty when i got an error, but he has the class "danger".He detect the errors, but no retrieve it. I feel that it is not possible to loop with handlebars ...
Thank you :)
Upvotes: 0
Views: 235
Reputation: 115
It's all good. It was {{#if messages.errors}} {{#each messages.errors }} {{ this.msg }} {{/each}} {{/if}}
Upvotes: 0