Closed hcapitaine closed 10 years ago
In general, deep binding doesn't work very well – meaning: binding to a property of a plain object stored within a model. The problem with attributes of a plain object is that they don't fire events. While you can read their values once, you won't get events off of them when they change, so the view has nothing to bind to. For this reason, just stick to binding to attributes (and computed attributes) of the bound model directly.
Given that I have this kind of model:
and this DOM element:
My problem is that my element is not bound.
So I had a look into the code and found that the function bindElementToView is the one applying binding from declarations. If the declaration is a string it takes the declaration from the dom element. Everything is OK for now.
But in this method, this part of the code:
executes the function from context for each part of the binding, in our case: mainObj().property() Of course property doesn't exist.
I think a possible way coulb be to flatten the model the model and then access it the same way.
What do you think about it?