I am working with backbone.js v 0.5.3.
I am wondering if there is a better way to set the id property of a view element. It seems redundant to always have to set it like so:
view = new Views.Foo( model: @model, id: 'foo-' + @model.id )
It would be nice if I could define the id in the view class like so
class Views.Foo extends Backbone.View
id: 'foo-' + @model.id
It is kind of nitpicky but I find myself defining id and data-attributes way too often.
Has anyone come up with a good way to initialize view el attributes?
You can put it to the constructor: