From the course: Reactivity and Signals in Angular

Unlock this course with a free trial

Join today to access over 24,900 courses taught by industry experts.

Angular signal effects

Angular signal effects

- [Instructor] Angular signal effects are not signals, but they work with signals to handle side effects that result from changing signal values. Effects always execute asynchronously as part of the component change detection lifecycle. This means parent effects run before child effects. Effects always run at least once and they track signals. And whenever any of the tracked values change, the effect runs again. Since effects run during change detection, they do not work the same as an observable stream. Observable streams handle every single value. Effects are scheduled when a tracked signal changes, but it is possible for the tracked value to change more than once before the effect callback is run. In this situation, the effect callback will use only the current value of the tracked signal. This means that an effect might not be the right tool if we need to use every single value. For most applications, effects are rarely needed. Effects can be useful for debugging, syncing with…

Contents