walmartlabs / thorax

Strengthening your Backbone
http://thoraxjs.org/
Other
1.32k stars 129 forks source link

Add item view attributes for collection view items #384

Open liorcode opened 9 years ago

liorcode commented 9 years ago

I added a way to pass attributes to the constructor of the item view.

This is how it is used Inside a collection view:

Thorax.CollectionView.extend({
    name: "app/list",
    initialize: function() {
        this.itemAttributes = {
            myVar : 'value'
        }
});

Then inside a collection item, myVar is availble:

Thorax.View.extend({
    name: "app/list-item",    
    initialize: function() {
        var a = this.myVar;
    }
});
CLAassistant commented 4 years ago

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.