Skip to content

Step 3 - Contacts Collection

Compare
Choose a tag to compare
@dmytroyarmak dmytroyarmak released this 03 Feb 07:39
  1. Add collections/contacts.js with collection:

    ContactManager.Collections.Contacts = Backbone.Collection.extend({
    model: ContactManager.Models.Contact
    });
    

    and to index.html:

    <script src="app/js/collections/contacts.js"></script>
    
  2. Create collections with few models in DevTools and show some methods

    var contacts = new ContactManager.Collections.Contacts([
    {
      id: 1,
      name : 'Terrence S. Hatfield',
      tel: '651-603-1723',
      email: '[email protected]'
    },
    {
      id: 2,
      name : 'Chris M. Manning',
      tel: '513-307-5859',
      email: '[email protected]'
    },
    ])
    
  3. All underscore.js methods for Collection

Difference