Skip to content

Instantly share code, notes, and snippets.

@mminguezz
Last active March 22, 2016 11:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mminguezz/f4f4d93652980fc6cdcb to your computer and use it in GitHub Desktop.
Save mminguezz/f4f4d93652980fc6cdcb to your computer and use it in GitHub Desktop.
<script type="text/template" id="sub_template">
<article>
<h1>id: <%= id %><h1>
</article>
</script>
<script type="text/template" id="main_template">
<% for (var i = 0; i < num; i++) { %>
<%= renderSub({id:i}) %>
<% } %>
</script>
var renderSub = _.template( $('#sub_template').remove().text() ),
renderMain = _.template( $('#main_template').remove().text() );
renderMain({num:5, renderSub:renderSub});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment