AUR9994
Error Message
AUR9994: "& attr" can be only used on property binding. It's used on <BindingConstructorName>
Where <BindingConstructorName> is the constructor name of the specific binding class instance it was incorrectly applied to.
Description
This error occurs when the attr binding behavior (used syntactically as & attr) is applied to a type of binding other than a standard property binding (like value.bind, src.bind, etc.). The purpose of & attr is specifically to change the target of a property binding from a DOM property to an HTML attribute.
Cause
The direct cause is applying & attr to an inappropriate binding type. This usually happens when:
Applying to Listener Bindings: Trying to use
& attron event listener bindings likeclick.triggerorinput.delegate.<!-- Incorrect --> <button click.trigger="doSomething() & attr">Click Me</button>Applying to Ref Bindings: Trying to use
& attronrefbindings.<!-- Incorrect --> <div ref="myDiv & attr"></div>Applying to Other Non-Property Bindings: Attempting to use it with other binding commands or syntax that doesn't resolve to a direct property assignment binding.
The & attr behavior only makes sense in the context of bindings that would normally target a DOM property, such as:
value.bind="firstName & attr"(targets thevalueattribute instead of thevalueproperty)xlink:href.bind="url & attr"(targets thexlink:hrefattribute)aria-label.bind="label & attr"(targets thearia-labelattribute)
Solution
Remove the & attr behavior from any binding that is not a property binding. If you need to manipulate attributes in response to events or other non-property-binding scenarios, you should typically do so using direct DOM manipulation within your view model or component logic, or by binding relevant view model properties to the attributes using standard property bindings (potentially with & attr if needed to force attribute targeting).
Example
Debugging Tips
Inspect the binding expression where the
& attrbehavior is used.Identify the type of binding command being used (e.g.,
.bind,.trigger,.delegate,ref).If the command is not
.bind(or implicitly.bindvia interpolation${}), remove the& attr.If the command is
.bind, ensure the target (the part before.bind) corresponds to a standard DOM property that you intend to target as an attribute instead.
</rewritten_file>
Last updated
Was this helpful?