
p.location-badge.
  exported from <a href='../core'>angular2/core</a>
  defined in <a href="https://github.com/angular/angular/tree/2.0.0-alpha.37/modules/angular2/src/core/di/injector.ts#L394-L831">angular2/src/core/di/injector.ts (line 394)</a>

:markdown
  A dependency injection container used for resolving dependencies.
  
  An `Injector` is a replacement for a `new` operator, which can automatically resolve the
  constructor dependencies.
  In typical use, application code asks for the dependencies in the constructor and they are
  resolved by the `Injector`.
  
  ## Example:
  
  Suppose that we want to inject an `Engine` into class `Car`, we would define it like this:
  
  ```javascript
  class Engine {
  }
  
  class Car {
    constructor(@Inject(Engine) engine) {
    }
  }
  
  ```
  
  Next we need to write the code that creates and instantiates the `Injector`. We then ask for the
  `root` object, `Car`, so that the `Injector` can recursively build all of that object's
  dependencies.
  
  ```javascript
  main() {
    var injector = Injector.resolveAndCreate([Car, Engine]);
  
    // Get a reference to the `root` object, which will recursively instantiate the tree.
    var car = injector.get(Car);
  }
  ```
  Notice that we don't use the `new` operator because we explicitly want to have the `Injector`
  resolve all of the object's dependencies automatically.
  
  
.l-main-section
  h2 Members
  .l-sub-section
    h3#constructor constructor

    
    pre.prettyprint
      code.
        constructor(_proto: ProtoInjector, _parent?: Injector, _depProvider?: DependencyProvider, _debugContext?: Function)
    
    :markdown




  .l-sub-section
    h3#debugContext debugContext

    
    pre.prettyprint
      code.
        debugContext()
    
    :markdown
      Returns debug information about the injector.
      
      This information is included into exceptions thrown by the injector.
      
      





  .l-sub-section
    h3#get get

    
    pre.prettyprint
      code.
        get(token: any)
    
    :markdown
      Retrieves an instance from the injector.
      





  .l-sub-section
    h3#getOptional getOptional

    
    pre.prettyprint
      code.
        getOptional(token: any)
    
    :markdown
      Retrieves an instance from the injector.
      





  .l-sub-section
    h3#getAt getAt

    
    pre.prettyprint
      code.
        getAt(index: number)
    
    :markdown
      Retrieves an instance from the injector.
      





  .l-sub-section
    h3#parent parent

    
    :markdown
      Direct parent of this injector.
      
      





  .l-sub-section
    h3#internalStrategy internalStrategy

    
    :markdown
      Internal. Do not use.
      
      We return `any` not to export the InjectorStrategy type.
      
      





  .l-sub-section
    h3#resolveAndCreateChild resolveAndCreateChild

    
    pre.prettyprint
      code.
        resolveAndCreateChild(bindings: Array&lt;Type | Binding | any[]&gt;, depProvider?: DependencyProvider)
    
    :markdown
      Creates a child injector and loads a new set of bindings into it.
      
      A resolution is a process of flattening multiple nested lists and converting individual
      bindings into a list of <a href='ResolvedBinding-class.html'><code>ResolvedBinding</code></a>s. The resolution can be cached by `resolve`
      for the <a href='Injector-class.html'><code>Injector</code></a> for performance-sensitive code.
      





  .l-sub-section
    h3#createChildFromResolved createChildFromResolved

    
    pre.prettyprint
      code.
        createChildFromResolved(bindings: ResolvedBinding[], depProvider?: DependencyProvider)
    
    :markdown
      Creates a child injector and loads a new set of <a href='ResolvedBinding-class.html'><code>ResolvedBinding</code></a>s into it.
      





  .l-sub-section
    h3#resolveAndInstantiate resolveAndInstantiate

    
    pre.prettyprint
      code.
        resolveAndInstantiate(binding: Type | Binding)
    
    :markdown
      Resolves a binding and instantiates an object in the context of the injector.
      





  .l-sub-section
    h3#instantiateResolved instantiateResolved

    
    pre.prettyprint
      code.
        instantiateResolved(binding: ResolvedBinding)
    
    :markdown
      Instantiates an object using a resolved binding in the context of the injector.
      





  .l-sub-section
    h3#displayName displayName

    
    :markdown





  .l-sub-section
    h3#toString toString

    
    pre.prettyprint
      code.
        toString()
    
    :markdown




