Skip to content
This repository was archived by the owner on Dec 6, 2017. It is now read-only.
This repository was archived by the owner on Dec 6, 2017. It is now read-only.

Ability to inject parameterized type with non primitive #170

Open
@jrote1

Description

@jrote1

Is it possible for the following to be made possible as currently i recieve the following error:

No provider found for GenericClass! (resolving IndexComponent -> IndexComponent -> GenericClass)

But it works if I use string instead of TestClass

My code:

@Injectable()
class GenericClass<T>{
    GenericClass();
}

class TestClass{


}

class Bootstrap extends Module {
    Bootstrap() {
        bind(new TypeLiteral<GenericClass<TestClass>>().type, inject: [], toFactory: ()=> new GenericClass<TestClass>());
        bind(IndexComponent);
    }
}

@Injectable()
class IndexComponent {
    GenericClass<TestClass> _test;

    IndexComponent(this._test);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions