AUR9993
Error Message
AUR9993: "& updateTrigger" binding behavior only works with the default implementation of Aurelia HTML observation. Implement your own node observation + updateTrigger
Description
This error occurs when the updateTrigger binding behavior (& updateTrigger:'event1'...'eventN') is used on a binding where the underlying observation mechanism does not support the standard event handling required by updateTrigger. The updateTrigger behavior relies on specific capabilities provided by Aurelia's default observation strategies for HTML elements to listen for DOM events and trigger updates.
Cause
The primary cause is using & updateTrigger in conjunction with a custom observation strategy or a binding scenario where Aurelia's default HTML observer is not employed or cannot provide the necessary event handling integration. This is relatively uncommon in standard application development but might occur if:
Custom Observation: You have implemented or are using a custom element or attribute with a bespoke observation mechanism that doesn't align with the internal requirements of the
updateTriggerbehavior.Unsupported Element/Property Combination: In rare cases, the specific combination of element and property being bound might use an internal observation strategy that isn't compatible with
updateTrigger. (This is less likely for standard HTML elements and properties).
The updateTrigger behavior needs to interact with an observer that can handle event listener management (specifically, an observer marked internally as $needsHandler: true). If the observer lacks this capability, the error is thrown.
Solution
Use Default Observation: If possible, refactor the binding or component to use Aurelia's standard HTML observation mechanisms, which are compatible with
updateTrigger. This usually means binding directly to standard HTML element properties likevalue,checked, etc.Implement Custom Update Logic: If standard observation is not feasible or desirable, you must implement the update-on-event logic manually. Instead of using
& updateTrigger, create event listeners (.triggeror.delegate) that call methods on your view model. These methods can then read the target property's value and update the source property accordingly.Re-evaluate Need for
updateTrigger: Consider ifupdateTriggeris strictly necessary. For many standard two-way bindings (.two-wayor default for inputs), Aurelia already updates the view model based on the appropriate default events (input,change, etc.).updateTriggeris mainly for changing which events trigger the update.
Example
Debugging Tips
Identify the binding where
& updateTriggeris causing the error.Examine the type of element and property being bound. Is it a standard HTML element/property or a custom one?
If it's a custom element/attribute, review its implementation, particularly how its properties are observed.
Temporarily remove the
& updateTriggerbehavior. Does the binding work otherwise?Consider implementing the logic manually using event listeners (
.trigger,.delegate) as shown in Solution 2 to bypass theupdateTriggermechanism if compatibility is the issue.
Last updated
Was this helpful?