Ladislav Maxa Ladislav Maxa - 1 year ago 53
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:

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 Source

can't you do something like this?

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