-
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.computes with can.Map.prototype.attr() do not set up bindings #626
Conversation
I actually noticed that today while reviewing can.Map's source code. |
Maybe a naive fix? I haven't been in this part of the code before but this definitely works. |
Thanks. Anyway you could add a test? Also, can you add a check that it updates if you add a property too? You will need to tell __reading about the __keys event (you can find this happening other places). Ah, too bad you missed the hangout today where I went over can.Map in detail :-). |
Okay - will do. |
It works on addition and subtraction of properties. Added __keys and test. |
can.computes with can.Map.prototype.attr() do not set up bindings
@onyxrev Thanks big time for the fix! |
If I use can.Map.prototype.attr() in a can.compute it doesn't set up a binding like can.Map.prototype.attr("some_property") does. I often use computes to generate dynamic links and I use .attr() to serialize the data in a can.Map for use in creating the URL parameters, for example. You may not know what data will be inside the can.Map, for example, so might want to use .attr() to explode the values out when they change.
Doesn't work:
Does work:
Example of dynamic URL: