angularjs - Angular 2 - injecting service into a component that the service created -


i have service, this:

constructor(private containerref: viewcontainerref, private resolver: componentresolver) {}  create(options: any) {     this.resolver.resolvecomponent(testcomponent)         .then((factory: componentfactory<testcomponent>) => {             let ref = this.containerref.createcomponent(factory);         }); } 

this creates testcomponent, good. problem comes, when try inject same service component.

constructor(private service: randomservice) { ... } 

and here exception: error: uncaught (in promise): typeerror: cannot read property 'query' of null.

i can inject other service component, not 1 created it. there way it?


Comments

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

java - Digest auth with Spring Security using javaconfig -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -