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' -

Making Empty C++ Project: General exception (Exception from HRESULT:0x80131500) Visual Studio Community 2015 -

How to fix java warning for "The value of the local variable is not used " -