-
Notifications
You must be signed in to change notification settings - Fork 87
Child Injector Mapping not stored? #54
Description
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);