Skip to content

Instantly share code, notes, and snippets.

@spikebrehm
Forked from julianlconnor/index.js
Last active December 24, 2015 20:49
Show Gist options
  • Save spikebrehm/6860378 to your computer and use it in GitHub Desktop.
Save spikebrehm/6860378 to your computer and use it in GitHub Desktop.
Example of how to use child views with the `view` helper for Rendr.
<h1>Some page</h1>
<div class="user-wrapper">
<div class="name">{{user.name}}</div>
</div>
<div class="balance">
{{user.balance}}
</div>
{{! You can use the `view` helper to nest child views. }}
<div class="feed-wrapper">
{{view 'feed' collection=feed}}
</div>
var BaseView = require('../base');
module.exports = BaseView.extend({
className: 'home_index_view',
getTemplateData: function() {
return {
user: this.options.user.toJSON(),
feed: this.options.feed
};
}
});
module.exports.id = 'home/index';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment