-
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.Component two way binding issues #537
Comments
Can you create a test because #1 works for me? |
This does not appear to be an issue. The fiddle you linked to in 508 is broken because your code is incorrect.
What's your email address? Can you shot me a message at Justin AT Bitovi? |
Well perhaps fiddle is incorrect, but there was another code in my version that I updated from master a couple of days before I found out this issue, and it didn't work: // there's a value, setup two-way binding ...
twoWayBindings[name] = propertyDataFromScope.parent and in current version it is: // setup two-way binding
twoWayBindings[name] = computeData Ok. But some problems still remain. |
I'm not sure what you are talking about. Please submit a breaking test. The code in your fiddle was wrong. Sent from my iPhone
|
this is broken in latest version:
|
Nested properties as defaults will not work the way you are using them. Sent from my iPhone
|
What do you think about such case: can.Component({
tag: 'my-toggle',
template: '<button can-click="toggle">Toggle</button>',
scope: {
shown: true,
toggle: function(){
this.attr('shown', !this.shown)
}
}
})
can.Component({
tag: 'my-parent',
// besides two way binding between visible and shown attributes,
// if there is no "visible" attribute defined in my-parent scope, it is set to initial "shown" value of my-toggle
template: '<my-toggle shown="visible"></my-toggle>',
scope: {
}
}) my-parent creates my-toggle and sets shown="visible", but visible attribute is not presented in my-parent scope initially, and in my-toggle it has default value. Some times it could be useful if while init of my-toggle component, visible attribute of my-parent would be set to value of shown attribute of my-toggle. |
I've described the problem with two way binding here:
#508 (comment)
Issue #1:
Such configuration:
won't currently work, as two way binding works only if parent's and low-level attributes share the same name (visible in this case):
Issue #2:
The case:
if while initialization "showing" is not set on parent scope and "visible" is set on init of low-level component.
It would be great if in that case after low-level component init, "showing" attribute of parent scope would be set to "visible" attribute value of low-level scope.
The text was updated successfully, but these errors were encountered: