Observe changes in your applications.
Aurelia provides a multitude of different wants to observe properties in your components and call a callback function when they change.
The following sections in the observation documentation will help you decide which observation strategy is appropriate for your applications, from the most commonly used to more advanced observation strategies.
The easiest way to watch for changes to specific view model properties is using the
@observabledecorator which provides an easy way to watch for changes to properties and react accordingly.
While still using the
@observableAPI, the effect observation approach has more boilerplate and is convenient for instances where you want to observe one or more effects. Examples include when the user moves their mouse or other changes you might want to watch, independent of the component lifecycle.
Unlike other forms of observation, HTML observation is when you want to watch for changes to specific properties on elements, especially for web component properties.
The observer locator API allows you to observe properties for changes manually. In many instances, you will want to use
@watchhowever, the observer locator can be useful in situations where you want to watch the properties of objects.