Closed RedJabber closed 8 years ago
You can use the current APIs together with async jQuery APIs like in the samples here: http://www.jsviews.com/#samples/jsr/composition/remote-tmpl and here http://www.jsviews.com/#compiletmpl.
For example - as a simple approach:
$.get("...person.txt", function(value) {
personTemplate = $.templates(value);
var html = personTemplate.render(people);
$("#peopleList").html(html);
});
Is there a reason why this is not sufficient, without needing to create new async APIs within JsRender?
As for having an asynchronous tag like {{load data url="/my-templates/another-remote-template" /}}
- the problem is that that could not be used within a template that is being rendered synchronously - it would ONLY be able to be used when rendering using some (yet to be implemented/defined) API.
On the other hand, with JsViews, one could design a tag which was async, but only when using a data-bound form: {^{load data url="/my-templates/another-remote-template" /}}
.
There are already a lot of features available with JsViews or JsRender when associated with JsRender on the server, as described here:
http://www.jsviews.com/#node/filetmpls and http://www.jsviews.com/#node/server-browser.
So I don't think we need to add more at this point. (If you feel these features are insufficient, then let me know how you would like them to be improved. But it would need to be for a later release after V1.0 has been released.)
@RedJabber - didn't hear back from you. Closing this issue for now...
Hi, Boris! Sorry for being away for so long. I've found workaroud as load and register required inline templates directly before render close to the way you wrote. Async autoload for included templates is not good idea.
The other case async auto load can be used:
I use jsRender with asyncronius template loader and i want to use own tag instead of sync "include". Isn't it real add async compilation interface in addition to current render?
Now I use require-js text! to reach texts, but have to define internal templates manualy.