Cookies concent notice

This site uses cookies from Google to deliver its services and to analyze traffic.
Learn more
Skip to main content
This site is no longer updated.Head to Angular.devHome
/

This is the archived documentation for Angular v17. Please visit angular.dev to see this page for the current version of Angular.

CreateEffectOptions

Options passed to the effect function.

      
      interface CreateEffectOptions {
  injector?: Injector
  manualCleanup?: boolean
  allowSignalWrites?: boolean
}
    

Properties

Property Description
injector?: Injector

The Injector in which to create the effect.

If this is not provided, the current injection context will be used instead (via inject).

manualCleanup?: boolean

Whether the effect should require manual cleanup.

If this is false (the default) the effect will automatically register itself to be cleaned up with the current DestroyRef.

allowSignalWrites?: boolean

Whether the effect should allow writing to signals.

Using effects to synchronize data by writing to signals can lead to confusing and potentially incorrect behavior, and should be enabled only when necessary.