Skip to content

Instantly share code, notes, and snippets.

@rightson
Created June 24, 2012 23:02
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 rightson/2985385 to your computer and use it in GitHub Desktop.
Save rightson/2985385 to your computer and use it in GitHub Desktop.
var myView = Backbone.View.extend({
initialize: function () {
console.log('create view');
},
el: '#container',
events: {
"click button": "render"
},
template: $('#list-template').children(),
render: function() {
var data = this.model.get('data');
for (var i=0, l=data.length; i<l; i++) {
var a = this.template.clone().find('a');
var li = a.attr('href', data[i].href)
li = li.text(data[i].text).end();
this.$el.find('ul').append(li);
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment