Created
March 4, 2017 00:26
-
-
Save dennismonsewicz/12456d725c21768d763161d5b67ce367 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
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