Natan Bueno
Natan Bueno

Reputation: 198

Sendgrid each markup is not working with table tag

I'm creating a dynamic template in Sendgrid and I tried to use the each markup with this code:

<table>
{{#each data}}
<tr>
    <td class="stats">
        <p>{{this.name}}</p>
    </td>
</tr>
{{/each}}
</table>

But when I saved this template the code is converted to:

{{#each data}}
{{/each}}
<table>
<tr>
    <td class="stats">
        <p>{{this.name}}</p>
    </td>
</tr>
</table>

This happens only with table tag, when I tried to use each with other tags, like p and b this error doesn't happens.

Do you know what happens? How could I fix it?

Upvotes: 1

Views: 1350

Answers (2)

OldManMcDonalds
OldManMcDonalds

Reputation: 1167

This one is answered here: In Sendgrid Design template, how to use handlebar iteration for table?

There's an undocumented workaround that can be used, check the duplicate.

Upvotes: 1

Natan Bueno
Natan Bueno

Reputation: 198

I receive this answer from sendgrid support

Good afternoon,

Thank you for contacting SendGrid Support! I would be happy to help you!

Thank you for going into depth with that example, that is very helpful. Just to clarify what you are seeing is when you are creating this template you are creating it in the design editor and the **** statement to end the conditional statement that it is being moved to the top is that correct? If so this is currently a bug that our engineers are aware of in the design editor so what I suggest when using dynamic templates with conditional statements is using strictly the code editor and not the design editor at all. Hopefully in the future this bug will be fixed in the design editor but unfortunately I do not have a time frame on this and recommend using the code editor. Also when I say code editor I do not mean creating a code module in a design template, I recommend creating the whole template in the code editor.

I look forward to hearing back from you

Upvotes: 0

Related Questions