A thin layer on top of Backbone's view class to add nested child views.
To install project dependencies:
make install
To run tests in development mode:
make testem
To run tests in continuous integration mode:
make
var message = new MessageView();
var reply = new ReplyView();
message.add(reply);
message.render();
Will render:
<div class="message">
<div class="reply">
</div>
</div>
See examples directory for more.
Adds a child view to the end of the view's element.
Optionally define the selector to attach to, which defaults to $el
.
Adds a child view to the beginning of the view's element.
Optionally define the selector to attach to, which defaults to $el
.
Removes all child views.
Renders the view's template with supplied data.
Defaults to using underscore templates, but can be overriden by replacing the
renderer
prototype property with any object that responds to compile
and
returns a function which renders the template with the supplied data, e.g:
Backbone.Component.prototype.renderer = {
compile: function(template) {
return _.partial(Mustache.render, template);
}
};