Skip to content

Instantly share code, notes, and snippets.

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 dennismonsewicz/12456d725c21768d763161d5b67ce367 to your computer and use it in GitHub Desktop.
Save dennismonsewicz/12456d725c21768d763161d5b67ce367 to your computer and use it in GitHub Desktop.
import Backbone from 'backbone';
import _ from 'lodash';
const html = `<div class="book"><%= title %> :: <%= pages %></div>`;
const Book = Backbone.Model.extend({
defaults: {
title: null,
pages: 0,
},
});
const View = Backbone.View.extend({
id: 'dogs',
template: _.template(html),
render() {
this.$el.html(this.template(this.model.toJSON()));
}
});
new View({ model: new Book() });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment