Ladislav Maxa Ladislav Maxa - 5 months ago 11
Javascript Question

How to get model property in className of ItemView?

I my app I need to render ul of users with their ids in class attribute of li. S I tried to do it like this:

Marionette.ItemView.extend({
tagName: 'li',
className: this.model.get('user_id'),
template: userTpl
});


But it didn't work. Is it possible to achieve this some other way?

Vic Vic
Answer

can't you do something like this?

className: function(){
  return this.model.get('user_id');
}