Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var TodoList = Backbone.Collection.extend({
- model: Todo,
- comparator: function(todo) {
- return todo.get('title');
- }
- });
- var TodoView = Backbone.View.extend({
- tagName: "li",
- template: _.template($('#item-template').html()),
- initialize: function() {
- this.listenTo(this.model, 'change', this.render);
- this.listenTo(this.model, 'destroy', this.remove);
- },
- render: function() {
- this.$el.html(this.template(this.model.toJSON()));
- this.$el.toggleClass('done', this.model.get('done'));
- this.input = this.$('.edit');
- return this;
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement