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
Use variable
var self = this;
orvar selectedConvId = this.get('selectedConvId');
for example