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

android - Why am I getting the message 'Youractivity.java is not an activity subclass or alias' -

python - How do I create a list index that loops through integers in another list -

c# - “System.Security.Cryptography.CryptographicException: Keyset does not exist” when reading private key from remote machine -