fix(element_injector): fixed element injector to inject view dependencies into its components

This commit is contained in:
vsavkin
2015-05-20 15:36:36 -07:00
parent dd9b08cce8
commit b6b52e62b2
2 changed files with 19 additions and 8 deletions

View File

@ -528,6 +528,16 @@ export function main() {
expect(inj.get('injectable2')).toEqual('injectable1-injectable2');
});
it("should instantiate components that depends on viewInjector dependencies", function () {
var inj = injector([
DirectiveBinding.createFromType(NeedsService,
new DummyDirective({viewInjector: [
bind('service').toValue('service')
]}))
], null, true);
expect(inj.get(NeedsService).service).toEqual('service');
});
it("should instantiate directives that depend on app services", function () {
var appInjector = Injector.resolveAndCreate([
bind("service").toValue("service")