codepb/jquery-template

Bug on external url templates when used on nested template.

Opened this issue · 2 comments

I found a bug on

<div data-content="comments" data-format="nestedTemplateFormatter" data-format-options='{"template":"assets/templates/comment_nested_template.html"}' ></div>

This doesn't work,

However there's a workaround via inline script

<div data-content="comments" data-format="nestedTemplateFormatter" data-format-options='{"template":"#comment_nested_template"}' ></div>

Note: I'm sure the link is correct because this one loads properly:

$('#posts').loadTemplate("assets/templates/post.html",{ },{});

there must be a problem on

handleTemplateLoadingSuccess function

Hey!
I ran in the same issue and invesigated a bit more.

It seems to be some kind of racecondition.
A quick (and dirty) workaround is to add internalSettings.async = false to addTemplateFormatter("nestedTemplateFormatter", ... ).

A propper fix would require to provide an asyncronous addTemplateFormatter.

ok I'll look into this when I get the time.