angular-providers Questions

3

Solved

I am trying to figure out how to use useFactory as an async function in Angular 11. Right now I have this: import { ApolloClientOptions } from 'apollo-client'; import { FirebaseService } from './fi...

3

I am getting above error even though I have imported CommonModule in all related modules having NgIf or NgFor and BrowserModule is only imported once in app.module.ts What else I can do please hel...
Configuration asked 15/1, 2024 at 13:48

6

In one of my unit test files, I have to mock several times the same service with different mocks. import { MyService } from '../services/myservice.service'; import { MockMyService1 } from '../mock...
Hyetal asked 15/2, 2018 at 15:45

4

In my Angular app, I'm trying to use a factory provider in my module: export function getMyFactory(): () => Window { return () => window; } @NgModule({ providers: [ { provide: WindowRef, ...

3

I would like to set up a factory that does async work to return a service, and then provide that factory to a factory provider to provide that service to a component when it loads. However, when t...
Coloration asked 16/9, 2017 at 18:32

2

Solved

I have to test one component and get this error NullInjectorError: R3InjectorError(DynamicTestModule)[AuthenticationService -> Router -> Router]: NullInjectorError: No provider for Router!**&...
Kedge asked 1/10, 2020 at 8:0

3

Solved

I have a complexe module called MyPageModule importing several modules which provides Service with following annotation @Injectable( { providedIn: 'root' } ). This module is imported by lazy loadi...
Thirtyeight asked 3/10, 2019 at 14:12

1

Solved

Just want to make sure I understand the semantics of @Injectable(providedIn: 'root'). Prior to Angular 6 if we import a module from NPM that contains a service we would declare that module in our...

1

Solved

I am using HTTP_INTERCEPTORS in angular4. For this, I have created HttpServiceInterceptor class that implements HttpInterceptor interface and provide the defintion for intercept method. Then regist...
Submiss asked 11/12, 2017 at 7:4

9

Solved

I have a code with AngularJS: service.doSomething() .then(function(result) { //do something with the result }); In AngularJS 1.5.9 when I have error in the .then() section like: service.doSo...

2

Solved

Right now, using Angular v5, while using lazy loading, I load all my providers in app.module.ts which I guess isn't maybe the best strategy because this won't speed up my app boot time, specially b...
Wriest asked 12/10, 2017 at 11:33

3

I really want to know What is providers? what relationship with DI in angular2? app.module.ts @NgModule({ imports: [ BrowserModule, FormsModule, ], declarations: [ test, ], bootstra...
Opposable asked 21/7, 2017 at 6:46

2

Solved

I'm trying to test a module that uses angular-google-maps. It is failing because angular.mock.inject cannot find uiGmapGoogleMapApiProvider: Error: [$injector:unpr] Unknown provider: uiGmapGoogleM...
Florafloral asked 11/8, 2016 at 16:16

1

I can't imagine a situation where I need to use a factory provider. According to the offical docs https://angular.io/docs/ts/latest/guide/dependency-injection.html the situation is that one may n...
Bianka asked 6/8, 2016 at 18:51
1

© 2022 - 2025 — McMap. All rights reserved.