Skip to content

Instantly share code, notes, and snippets.

@deanlandolt
Forked from dmachi/lazy template
Created September 27, 2010 17:09
Show Gist options
  • Save deanlandolt/599389 to your computer and use it in GitHub Desktop.
Save deanlandolt/599389 to your computer and use it in GitHub Desktop.
//load the template, should return a promise from the compile() method
if (response.status > 400) {
//print("Error Response: " + response.status);
template = templateEngine.compile("/error/"+response.status);
}else{
template = templateEngine.compile(templateId, (mediaParams && mediaParams.template));
}
//when we get the template function back, execute it which returns the rendered html
// i've tried a bunch of different ways to do this, but i'm not sure what should be happening in the when here
return when(template, function(t){
return when(t(object), function(string) {
// this assumes the template returns a string
return [string];
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment