Collections are simply object containers that consist of a collection of other items or objects. Think of collections as a list of alike objects. Collections in Lava are very powerful allowing you to bind to for tags in templates or views. They also expose very useful methods such as where() and forEach() that allow for better control and manipulation of the items in the collection.

Here is an example of a Collection in an Object:

var Contact = Lava.Object({
    first: '',
    last: '',
    email: ''

var SalesPerson = Lava.Object({
    first: 'John',
    last: 'Doe',
    contacts: Lava.Collection.of(Contact)

Last edited Dec 12, 2012 at 1:10 PM by tjscience, version 1


No comments yet.