-
Notifications
You must be signed in to change notification settings - Fork 422
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't 2-way bind Array #463
Comments
Definitely there is a bug around returning functions from helpers here, but you can use can.view.hook() to enable two-way binding as you like. Here's your updated fiddle (and I fixed your helper too -- the 'value' property and the form element's value were mixed up): http://jsfiddle.net/air_hadoken/w4rdH/17/ |
excellent workaround for this, I didn't think of using hook. |
Did this get you on the right path? If it did, can you close the issue? |
No, it didn't, it works in a limited way on jsfiddle, but in real Apps, the helper is still failing (just differently). I will put more time into this, but it's still essentially a problem with arrays not being passed properly. I wouldn't say the work-around would have closed the issue anyway, it's not an intuitive solution and certainly not something you would expect to be a problem in a helper. |
I have the same issue, but i can't understand what causes it |
This issue is hitting meu almost everywhere i have two-way helpers on Observe.List instances, for example a list of elements repeated for every Observe inside an Observe.List. After that line compute.hasDependencies >= 1 and in the end line 177 of the same file is executed, pushing an item in pendingHooks to execute live.attributes with arguments el, compute and the two way helper function which is not what live.attributes expects,IMHO. Thanks in advance |
Frequently I use a textbox for editing Tokenized Lists such as Tags.
It appears that there is a problem when passing an array to a mustache helper with a function.
Here is a fiddle demonstrating an error in live.js that prevents this.
http://jsfiddle.net/w4rdH/15/
What should happen here is:
The helper with a single value should bind to dummy element which works properly. (set to 'John')
The helper with an array value should bind to dummy2 element which is broken. (not set to 'Alex Bill')
In the AMD version, the error manifests differently and the result is that textbox value is set to the toString() value of the helper function.
I have tried to resolve this with several changes to the way the helper is constructed to no avail, nothing seems to accept an array if the return value is a function.
Any suggestions are welcome, this really appears to be a bug in live.js when constructing computes.
The text was updated successfully, but these errors were encountered: