Skip to content

Instantly share code, notes, and snippets.

@codeschool-courses
Created March 7, 2012 21:25
Show Gist options
  • Save codeschool-courses/1996339 to your computer and use it in GitHub Desktop.
Save codeschool-courses/1996339 to your computer and use it in GitHub Desktop.
Anatomy of Backbone 1-7
var Appointment = Backbone.Model.extend({});
var appointment = new Appointment();
appointment.set('title', 'My knee hurts');
var AppointmentView = Backbone.View.extend({
render: function(){
$(this.el).html('<li>' + this.model.get('title') + '</li>');
}
});
var appointmentView = new AppointmentView({model: appointment});
@anshula
Copy link

anshula commented Jun 28, 2013

it's just a JQuery selector that gets an element with the id of "app" from the html file. however, since the code school course doesn't show html files, you just have to assume that this backbone script is called from an html doc that has a tag with an id of "app". this is where you nest the appointment view's element (li). was that what you were asking?

@Gero1369
Copy link

this exercise, "Set the Title", and "View Instance" seem not to be working correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment