Permalink
Browse files

Merge pull request #7 from scottux/master

hookupView
  • Loading branch information...
tdreyno committed Apr 17, 2012
2 parents cc88966 + 5b61455 commit b1c008a3810d98f7b9261ea810755cff90c1663e
Showing with 15 additions and 0 deletions.
  1. +11 −0 README.markdown
  2. +4 −0 mustache.js
View
@@ -26,3 +26,14 @@ Create some .mustache files and use them normally:
$("#elem").html("//views/template.mustache", { variable: "Value" })
+Using "hookupModel" and "hookupView":
+
+ <script type="text/mustache" id="subView">
+ <div {{{hookupModel}}}></div>
+ </script>
+
+ <script type="text/mustache" id="mainView">
+ {{#each this}}
+ {{{hookupView "subView" this}}}
+ {{/each}}
+ </script>
View
@@ -40,4 +40,8 @@ steal('jquery/view','jquery/lang/json')
});
return 'data-view-id="' + id + '"';
});
+
+ Handlebars.registerHelper('hookupView', function(view, item) {
+ return $.View(view, item);
+ });
})

0 comments on commit b1c008a

Please sign in to comment.