Last active
March 22, 2016 11:27
-
-
Save mminguezz/f4f4d93652980fc6cdcb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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