Created
March 20, 2014 21:25
-
-
Save sebastienblanc/9674210 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bind: [{ | |
to: { $ref: 'firstCollection' }, | |
bindings: { | |
firstName: '.first-name', | |
lastName: '.last-name' | |
}, | |
{to: { $ref: 'secondCollection' }, | |
bindings: { | |
contractNumber: '.contractNumber', | |
lastName: '.last-name' | |
} | |
}] |
If you show a little bit more of the wire spec, I might be able to give some more detailed help. :)
This is what I would like to do
conversationSectionView: {
render: {
template: { module: 'text!app/conversation/ConversationSection.html' }
},
insert: { after: 'controllerView' },
bind: {
to: { $ref: 'conversations' },
bindings : {
lastMessage: ".lastMessage"
}
},
bind: {
to: { $ref: 'contacts' },
bindings : {
displayName: ".displayName"
}
}
},
conversationSectionView: {
render: {
template: { module: 'text!app/conversation/ConversationSection.html' }
},
insert: { after: 'controllerView' },
bind: {
to: { $ref: 'conversations' },
bindings : {
lastMessage: ".lastMessage"
}
}
},
contactsSubsectionView: {
// query for a child of conversationSectionView
element: { $ref: '.some-class-of-a-child-element', at: { $ref: 'conversationSectionView' } },
bind: {
to: { $ref: 'contacts' },
bindings : {
displayName: ".displayName"
}
}
}
oops, i goofed on this line. the "at" doesn't need another "$ref":
element: { $ref: '.some-class-of-a-child-element', at: 'conversationSectionView' },
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey @sebastienblanc,
The
bind
facet only takes a single object, not an array.This is really interesting. How can two collections be bound to the same element (the element matching ".last-name")? This seems like it would cause havoc, no?
It's certainly possible to have two collections bound into the same DOM fragment, but I would think you would want to bind to different elements (or element attributes) in that fragment. In this case, you need to use the
bind
facet on two different element-components. One could be a parent of the other.-- John