mardi 9 juin 2015

Inserting external parameter in map function with ember

I have this function:

this.get('model').map(function(item){
            if(item.get('isSelected')){
                item.set('selectedClass', 'conversation-history');
            }
        }); 

What I would like to do :

this.get('model').map(function(item){
            if(item.get('id') == this.get('selectedConvId')){
                item.set('selectedClass', 'conversation-history');
            }
        }); 

This tells me this.get is not a function, and I understand why, I am not in the same scope. But how can I introduce an external parameter in the map function? Thank you

Aucun commentaire:

Enregistrer un commentaire