Last active
December 16, 2015 22:30
-
-
Save kimjoar/5507841 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
define(function(require) { | |
var View = require('base/view'); | |
var menuTemplate = require('hgn!./menu'); | |
var MenuView = View.extend({ | |
template: menuTemplate, | |
initialize: function(options) { | |
this.cart = options.cart; | |
this.listenTo(this.cart, 'change', this.render); | |
}, | |
render: function() { | |
this.renderTemplate(this.cart.toJSON()); | |
return this; | |
} | |
}); | |
return MenuView; | |
}); |
This file contains hidden or 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
define(function(require) { | |
var Backbone = require('backbone'); | |
var _ = require('underscore'); | |
var View = Backbone.View.extend({ | |
renderTemplate: function() { | |
var data = _.extend.apply(null, arguments); | |
var html = this.template(data); | |
this.$el.html(html); | |
return this; | |
} | |
}); | |
return View; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment