Search code examples
javascriptbackbone.jsmarionette

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?


Solution

  • can't you do something like this?

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