dependency injection - How to resolve and create Generic Classes in AngularJS Injector -


have class below,

export class siteeventservicetype<t> { } 

how need create instance above class using angularjs 2 injector.

tried not working:

 injector.resolveandcreate([siteeventservicetype<string>]).get(siteeventservicetype<string>); 

this example posted quite while @ https://github.com/angular/angular/pull/1779

@component(   selector: 'my-component',   // providers:   injectables: const [       const binding(           const typeliteral<stream<string>>,            tofactory: mycomponent.streamfactory)   ] ) @view(   directives: const [mychildcomponent],   template: '<my-child-component></my-child-component>' ) class mycomponent {   static stream<string> streamfactory() => new stream.fromiterable(['hello']); }  @component(   selector: 'my-child-component' ) @view(   template: '{{lastvalue}}' ) class mychildcomponent {   string lastvalue;    mychildcomponent(stream<string> stringstream) {     stringstream.listen((value) => lastvalue = value);   } } 

see


Comments

Popular posts from this blog

sql - VB.NET Operand type clash: date is incompatible with int error -

SVG stroke-linecap doesn't work for circles in Firefox? -

python - TypeError: Scalar value for argument 'color' is not numeric in openCV -