title: How does Backbone.js connect View to Model
body: <p>I am trying to learn backbone.js through the following example.
  Then I got stuck at the point </p>
  
  <pre><code>ItemView = Backbone.View.extend
  </code></pre>
  
  <p>why you can use this.model.get?
  I thought this is referring to the instance of ItemView that would be created. Then why would ItemView has a model property at all?!!</p>
  
  <pre><code>    (function($){
        var Item = Backbone.Model.extend({
          defaults: {
            part1: 'hello',
            part2: 'world'
          }
        });
  
        var List = Backbone.Collection.extend({
          model: Item
        });
  
  
  var ItemView = Backbone.View.extend({
  
          tagName: 'li', 
          initialize: function(){
            _.bindAll(this, 'render');
          },
          render: function(){
            $(this.el).html('&lt;span&gt;'+this.model.get('part1')+' '+this.model.get('part2')+'&lt;/span&gt;');
            return this;
          }
        });
  
        var ListView = Backbone.View.extend({
          el: $('body'), 
          events: {
            'click button#add': 'addItem'
          },
          initialize: function(){
            _.bindAll(this, 'render', 'addItem', 'appendItem'); 
  
            this.collection = new List();
            this.collection.bind('add', this.appendItem); 
  
            this.counter = 0;
            this.render();
          },
          render: function(){
            $(this.el).append("&lt;button id='add'&gt;Add list item&lt;/button&gt;");
            $(this.el).append("&lt;ul&gt;&lt;/ul&gt;");
            _(this.collection.models).each(function(item){ 
              appendItem(item);
            }, this);
          },
          addItem: function(){
            this.counter++;
            var item = new Item();
            item.set({
              part2: item.get('part2') + this.counter
            });
            this.collection.add(item);
          },
  
          appendItem: function(item){
            var itemView = new ItemView({
              model: item
            });
            $('ul', this.el).append(itemView.render().el);
          }
        });
  
        var listView = new ListView();      
      })(jQuery);
  </code></pre>