0
{{#if errors}}
                    {{#each errors}}
                        <div class="alert alert-danger">{{msg}}</div>
                    {{/each}}
                {{/if}}

Above code will work if only I have a msg object in my errors array. It won't work if I have just an errors arary. I've tried {{errors}} and {{this}} and expect my array values but no luck. Any help?

1 Answer 1

0

Do you have an example somewhere of your code? Without an example, I can only guess what the problem it.

You shouldn't need an "if" statement if errors is an array. "each" of an empty array is nothing.

If you really are just getting strings, "this" should work, see: Rendering a string array with handlebars

If you're unsure what you're getting, you can always add {{log this}} in your for each to see what you're getting.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.