Skip to content
This repository was archived by the owner on Jul 3, 2019. It is now read-only.

Child Injector Mapping not stored? #54

@chrisathook

Description

@chrisathook

I ran into an interesting problem today while trying to create a child injector and I thought it might be an issue with 1.6. I was mapping an injection by value and event though though injector.hasMapping () returned true i was still giving me a mapping not found error.

i found that if i added a getInstance call it fixed it issue. It did not create a new instance, the dependency was mapped already it just was not being made avaliable.

// Does not work.

var childInjector:IInjector = injector.createChild (injector.applicationDomain);

var vo:InfoGraphicsDataModel = new InfoGraphicsDataModel (item,childInjector);

childInjector.mapValue (IInfoGrahicsDataModel, vo);

childInjector.injectInto (vo.rawContent);

// does work

var childInjector:IInjector = injector.createChild (injector.applicationDomain);

var vo:InfoGraphicsDataModel = new InfoGraphicsDataModel (item,childInjector);

childInjector.mapValue (IInfoGrahicsDataModel, vo);
childInjector.getInstance (IInfoGrahicsDataModel);
childInjector.injectInto (vo.rawContent);

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions