angular2-injection Questions

7

Solved

I have a @Injectable service defined in Bootstrap. I want to get the instance of the service without using constructor injection. I tried using ReflectiveInjector.resolveAndCreate but that seem to ...
Avalos asked 27/5, 2016 at 11:34

6

Solved

Context I created an ApiService class to be able to handle our custom API queries, while using our own serializer + other features. ApiService's constructor signature is: constructor(metaManager: M...

3

Solved

I have a method handleError() like in the documentation https://angular.io/docs/ts/latest/guide/server-communication.html#!#error-handling private handleError(error: any) { console.error(error); ...
Alfons asked 23/6, 2016 at 10:17

4

Solved

I tried to import the http provider into a service, but I'm getting the following error: Cannot resolve all parameters for 'AppService'(?). Make sure that all the parameters are decorated with I...

3

Solved

I want to create service, which can interact with one component. All another components in my app, should be able to call this service, and this service should interact with this component. How to...

2

Solved

Is there an easy way to inject an input binding into the deps array of a provider factory? Below obviously does not work. const myServiceFactory = (object: any) => { //... }; @Component({ //...
Cogwheel asked 4/3, 2017 at 7:22

0

Is there information about a Module's lifecycle. Currently the lifecycle of Components inside Angular is well documented and we have hook methods like ngOnInit(), ngDoCheck(), etc. Do we have simi...
Jewish asked 13/3, 2018 at 12:1

2

Solved

I've been looking at the Angular 2 APIs for ComponentResolver and DynamicComponentResolver for creating dynamic components, but I have something different in mind than those APIs offer. Is there a...
Faulkner asked 10/11, 2016 at 13:16

2

Solved

Is there a way get an instance of an injectable service of angular 2 just by the service name? For Example, in Angular 1 you could write: var service = $injector.get('ServiceName'); and the ser...
Defence asked 4/1, 2017 at 18:49

1

I am using angular2 rc 5, I have written a custom pipe that fetches value from a json. The custom pipe : literal.pipe.ts looks like : import {Pipe, PipeTransform, Inject} from '@angular/core'; imp...
Redmond asked 18/8, 2016 at 13:2

1

Solved

Can we inject different provider while loading components dynamically? my-component @Component({ moduleId: module.id, selector: "my-component", template: "<div>my-component</div>"...
Toothbrush asked 9/6, 2016 at 19:16

1

Solved

I have a MetaManager class: @Injectable() export class MetaManager{ constructor(private handlers:Handler[]){ console.log(handlers); } } this class needs a Handler[] to register as handlers. ...
Spadiceous asked 24/3, 2016 at 17:0
1

© 2022 - 2024 — McMap. All rights reserved.