Advanced Attribute Binding)
How it works
Aurelia, by default, will automatically bind properties to attributes using the native binding syntax. This is accomplished by using a mapping function that converts an aurelia property into a native html attribute. See the attribute mapper for an example of how this is done.
Attributes are turned into camel-case equivalent properties by default if there's no mapping specified, so for example, some-fake-attribute.bind="prop"
will set someFakeAttribute
on the element properties to the value of prop
.
In some cases though, not all properties will be mapped automatically to attributes. In these cases, you have several options.
Attribute tag
One method is to replace .bind
with .attr
. This will ensure that the property is correctly mapped to the attribute.
<input pattern.attr="patternProp">
Attribute binding behavior
Another option is to apply the attribute binding behavior (`.attr). This also gives you the ability to specify binding type.
<input pattern.bind="patternProp & attr">
Extend the attribute mapper
TODO: This section is in progress
Last updated
Was this helpful?