Skip to content
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

Makes attribute arguments passed to a component two way binding #508

Merged
merged 1 commit into from Oct 21, 2013

Conversation

justinbmeyer
Copy link
Contributor

If you have a "master" component with a scope value like:

scope: {
  visible: true
}

Pass that property to a low-level compute like:

<low-level showing='visible'></low-level>

If low-level has code like

this.attr('showing', true)

it should change the parent scope's visible property.

justinbmeyer added a commit that referenced this pull request Oct 21, 2013
…rguments

Makes attribute arguments passed to a component two way binding
@justinbmeyer justinbmeyer merged commit 4832936 into master Oct 21, 2013
@wclr
Copy link
Contributor

wclr commented Nov 4, 2013

Justin, your test passes only because parent and child components have the same name for the attribute

<my-toggler visible="visible">

if you replace "visible" attr in child for example with "shown", something like:

<my-toggler shown="visible">

two way binding won't work as it will try to change "shown" attribute in parent, not "visible".

Here is fiddle
http://jsfiddle.net/xKc3H/249/

@wclr
Copy link
Contributor

wclr commented Nov 4, 2013

End there is another problem with two way binding if you try to bind "complex" properties:

<my-toggler shown="visibility.visible">

propertyDataFromScope.parent for "visibility.visible" is not parent scope, but visibility map.

@justinbmeyer
Copy link
Contributor Author

A fiddle would not show this breaking because this is fixed for 2.0.1. Have you tried it with that code?

@wclr
Copy link
Contributor

wclr commented Nov 4, 2013

Yes I tried it in my project, I updated can.js yesterday from master. I had to change some code to fix this behaviour. Where there any fixes for this?

@wclr
Copy link
Contributor

wclr commented Nov 9, 2013

Would you confirm that this doesn't work? If yes, it is quite severe, issue should be opened and fixed for 2.0.1, I think.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants