gmac / backbone.epoxy

Declarative data binding and computed models for Backbone
http://epoxyjs.org
MIT License
615 stars 89 forks source link

Specify bindings in view *and* in DOM (via data-bind attribute) #144

Open computrav opened 7 years ago

computrav commented 7 years ago

Currently, it appears that you can specify bindings using an object (hash) in the view , OR you can specify them via the DOM using the "data-bind" attribute on DOM elements (or, this can be customized by passing a string for the "bindings" attribute in the view.

What I'm wondering/requesting is to support BOTH -- i.e., provide a hash but still support data-bind via the DOM. This would require some implied precedence of course, in the event a binding for the same element were specified in both the DOM and View (I would think the View should get precedence). Being able to specify the attribute to use (by default, "data-bind") would ideally still be possible - perhaps move that option to a different attribute when defining the view?

Alternatively, is there some other manual workaround for supporting this in my app?

The use case here is that sometimes the more complex things are better-managed in the view, but the simple ones are suitable for placement in the DOM.