#

API Docs for: v2.11.1
Show: Inherited Protected Private Deprecated

# ContainerProxyMixin Class

Defined in: `packages/ember-runtime/lib/mixins/container_proxy.js:10`
Module: ember-runtime
Parent Module: ember

ContainerProxyMixin is used to provide public access to specific container functionality.

- Index
- Methods
- Properties

## Item Index

### Methods

- _lookupFactory
- _resolveLocalLookupName
- lookup
- ownerInjection

### Properties

- __container__

## Methods

### `_lookupFactory`

(

- `fullName`

)
Any private

Defined in `packages/ember-runtime/lib/mixins/container_proxy.js:97`

Given a fullName return the corresponding factory.

#### Parameters:

- `fullName` String

#### Returns:

Any:

### `_resolveLocalLookupName`

(

- `fullName`
- `source`

)
String private

Defined in `packages/ember-runtime/lib/mixins/container_proxy.js:109`

Given a name and a source path, resolve the fullName

#### Parameters:

- `fullName` String
- `source` String

#### Returns:

String:

### `lookup`

(

- `fullName`
- `options`

)
Any public

Defined in `packages/ember-runtime/lib/mixins/container_proxy.js:49`

Given a fullName return a corresponding instance.

The default behaviour is for lookup to return a singleton instance. The singleton is scoped to the container, allowing multiple containers to all have their own locally scoped singletons.

    let registry = new Registry();
    let container = registry.container();

    registry.register('api:twitter', Twitter);

    let twitter = container.lookup('api:twitter');

    twitter instanceof Twitter; // => true

    // by default the container will return singletons
    let twitter2 = container.lookup('api:twitter');
    twitter2 instanceof Twitter; // => true

    twitter === twitter2; //=> true

If singletons are not wanted an optional flag can be provided at lookup.

    let registry = new Registry();
    let container = registry.container();

    registry.register('api:twitter', Twitter);

    let twitter = container.lookup('api:twitter', { singleton: false });
    let twitter2 = container.lookup('api:twitter', { singleton: false });

    twitter === twitter2; //=> false

#### Parameters:

- `fullName` String
- `options` Object

#### Returns:

Any:

### `ownerInjection`

() Object public

Defined in `packages/ember-runtime/lib/mixins/container_proxy.js:26`

Returns an object that can be used to provide an owner to a manually created instance.

Example:

    let owner = Ember.getOwner(this);

    User.create(
      owner.ownerInjection(),
      { username: 'rwjblue' }
    )

#### Returns:

Object:

## Properties

### `__container__`

Ember.Container private

Defined in `packages/ember-runtime/lib/mixins/container_proxy.js:18`

The container stores state.