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.

InjectOptions

Type of the options argument to inject.

      
      interface InjectOptions {
  optional?: boolean
  skipSelf?: boolean
  self?: boolean
  host?: boolean
}
    

Properties

Property Description
optional?: boolean

Use optional injection, and return null if the requested token is not found.

skipSelf?: boolean

Start injection at the parent of the current injector.

self?: boolean

Only query the current injector for the token, and don't fall back to the parent injector if it's not found.

host?: boolean

Stop injection at the host component's injector. Only relevant when injecting from an element injector, and a no-op for environment injectors.