angular2-di 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
4
Each component can specify new Providers using its providers property in ComponentMetadata.
Is there a way to specify providers dynamically from, say, constructor of the component?
Buchner asked 10/1, 2016 at 23:45
2
Solved
I'm trying to inject a parent component into a child component. I thought this would be straightforward – simply specify/inject the parent component in the child's constructor():
constructor...
Carton asked 31/12, 2015 at 3:27
2
Solved
I've a component that takes function as input. I've passed this function from parent.
Though the function is called, the function is not able to access the dependencies of the instance on which th...
Powerboat asked 3/3, 2017 at 9:10
3
Solved
I need to access my custom http service from inside a static method, as example:
import {Control} from 'angular2/common';
import {HttpService} from './http.service';
class UsernameValidator {
st...
Fogged asked 19/2, 2016 at 12:35
3
Solved
I've created a simple Hello World app that works fine. But when I want to add a "Service" just a simple Di I got the following errors:
angular2.dev.js:23877 EXCEPTION: Cannot resolve all parameter...
Acerbic asked 1/4, 2016 at 18:21
1
Solved
I'm preloading app configuration from server with APP_INITIALIZER in following way, AppModule:
providers: [
ConfigService,
{
provide: APP_INITIALIZER,
useFactory: configServiceFactory,
deps: ...
Logic asked 27/3, 2017 at 16:4
4
Solved
In Angular 1 I frequently used factories for services to store shared state accessible by many components. It looks like in Angular 2 all services that are injected as @Injectable() are created eac...
Valerio asked 2/9, 2016 at 4:38
1
Solved
I'm looking at the implementation of in-memory-web-api and there is the following code:
@Injectable()
export class InMemoryBackendService {
protected config: InMemoryBackendConfigArgs = new InMem...
Francis asked 20/2, 2017 at 14:57
1
Solved
Here is the code snippet from angular.io:
{ provide: RUNNERS_UP, useFactory: runnersUpFactory(2), deps: [Hero, HeroService] }
...
export function runnersUpFactory(take: number) {
return (winner...
Billi asked 24/1, 2017 at 6:59
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
3
Solved
I'm using Angular 2.0.0 with TypeScript in ASP.NET Core. My goal is to create AppConfig service in my app, based on server-side variables. With a help from few other answers, I was able to create f...
Nitz asked 28/9, 2016 at 10:7
0
TL;DR 25.10.16: update
I renamed the title to provide more clarification as i am still concerned about the right solution.
Given a module
@NgModule({
imports: [
ExternalModule.forRoot(config),...
Armandinaarmando asked 18/10, 2016 at 11:13
5
Solved
I have been trying to figure out how the (DI) Dependency Injection work in Angular2. I ran into lots of problem/issue every time when I tried to Inject a service/or class into my components.
From...
Alfy asked 20/3, 2016 at 2:20
1
Solved
I am using RC3. I am implementing the new Angular2 router as documented here: https://angular.io/docs/ts/latest/guide/router.html
Everything works fine but I am having problem in unit testing. Spec...
Violaviolable asked 28/6, 2016 at 15:38
2
I have app.component like this.
import {Component} from "angular2/core"
import {HTTP_PROVIDERS} from "angular2/http"
import {ChartDataService} from '../service/chartData.service'
import {FilterSe...
Shopwindow asked 4/3, 2016 at 21:45
1
© 2022 - 2024 — McMap. All rights reserved.