haiau79
haiau79

Reputation: 77

Aurelia binding for child elements

I have a couple custom elements laid out like this

<panel label="Label">
   <row-panel title="Row1">
      <button field="Row1" command="Label"></button>        
   </row-panel>
</panel>

Is there a way to use the title attribute "label" value of row-panel in the button attribute value for "field"?

Is there a way to use the panel attribute "label" value as the button "command" attribute value?

Ideally, I'd like the markup to look like this if possible.

<panel label="Label">
   <row-panel title="Row1">
      <button></button>        
   </row-panel>
</panel>

and the button element would inherit its field and command attributes from the two elements above it.

Any suggestions would be greatly appreciated!

Upvotes: 2

Views: 414

Answers (1)

Fabio
Fabio

Reputation: 11990

You could create a property and bind it to all elements. Like this:

<panel label.bind="myProperty">
   <row-panel title.bind="myProperty">
      <button field.bind="myProperty"></button>        
   </row-panel>
</panel>

Upvotes: 0

Related Questions