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.

InjectFlags

Injection flags for DI.

Deprecated: use an options object for inject instead.

      
      enum InjectFlags {
  Default: 0b0000
  Host: 0b0001
  Self: 0b0010
  SkipSelf: 0b0100
  Optional: 0b1000
}
    

Members

Member Description
Default: 0b0000

Check self and check parent injector if needed

Host: 0b0001

Specifies that an injector should retrieve a dependency from any injector until reaching the host element of the current component. (Only used with Element Injector)

Self: 0b0010

Don't ascend to ancestors of the node requesting injection.

SkipSelf: 0b0100

Skip the node that is requesting injection.

Optional: 0b1000

Inject defaultValue instead if token not found.