Open rubenstolk opened 10 years ago
Could you provide an implementation example to demonstrate what you're referring to, please?
Currently bindingHandlers are kind of static functions without any context. If for example I want to calculate something based on information available in the view, this is currently not possible. That's why I think it would be a great option to be able to have access to the view...
I have found one workaround:
this
inside a custom binding handler in a reference to the model and inside the model there is a view
link:
bindingHandlers: {
myHandler: function($element, value) {
var view = this.view;
// ...
}
}
However, this is not a good solution, because the model could be used in different views at the same time...
It would be good if Epoxy developers would add an additional argument to the handler function:
bindingHandlers: {
/** @param {Backbone.View} view */
myHandler: function($element, value, view) {
// ...
}
}
I think it would be nice if the bindingHandlers are called with a 3rd argument which is the view, this will make it easier to access for example given options on the view.