Backbone has an _ensureElement method that it uses to create the el context. Instead of just wrapping a template in a div, just use the method from Backbone.
This gives us all the options that Backbone.View has such as:
className
tagName
attributes
I had to override the Backbone method because each Component has an id so the normal _ensureElement will give every component's view an id. This would be an issue if you want to use a component multiple times.
Backbone has an
_ensureElement
method that it uses to create theel
context. Instead of just wrapping a template in a div, just use the method from Backbone.This gives us all the options that Backbone.View has such as:
I had to override the Backbone method because each Component has an id so the normal
_ensureElement
will give every component's view an id. This would be an issue if you want to use a component multiple times.It should allow this:
Which generates a normal backbone view el:
Works in my tests but I want to make sure someone else looks it over. Still wrapping my head around the library.