Closed elidupuis closed 10 years ago
Not quite sure, but I would prefer that to be stable.
I think that was left over from some older each
code. The better approach I would recommend would be to get the reactive
instance from the binding
instance and then get the model
from that.
https://github.com/component/reactive/blob/master/lib/each.js#L7
var binding = this;
binding.reactive.model;
Inside of the binding, the this
is the binding instance (as you already know) and that has a reactive property which is the current reactive instance.
Thanks @defunctzombie, that works great!
In the docs, its says a custom binding "will accept two arguments" but it appears that the model is passed as a third argument.
Is this something that's safe to use (as in, it's unlikely to change in the future)? If so, can the docs reflect that?
If not, what's the best approach to accessing many model properties in a custom binding?