The service providers are constructor functions. When instantiated they must contain a property called $get, which holds the service factory function.
Questions tagged [angular-providers]
173 questions
1
vote
1 answer
circular dependency, how to get rid
I tried to reproduce the problem in a stackblitz, but I do not have the warning in the blitz..
Basically,
my-module.module.ts import a component, so depend on it
import { MyComponentComponent } from './my-component/my-component.component';
the…

Crocsx
- 2,534
- 1
- 28
- 50
1
vote
4 answers
Angular 5 - Loading data from URL into a provider so it's available everywhere in the app
I have an encoded URL parameter that I need to decode when the app initializes. I need to do this in a provider because that object needs to be available to routing guards as well as components.
I have the following provider. It grabs the incoming…

Paul Erdos
- 1,355
- 2
- 23
- 47
1
vote
0 answers
Angular static provider bootstrap not overriding application root provider
Using Angular 6.0.3
Have a third party Azure Adal wrapper that is imported into the root application module:
@NgModule({
imports: [
....
<3rd party module>.forRoot()
....
]
})
export class AppModule {}
[third…

Matthew Campbell
- 1,864
- 3
- 24
- 51
1
vote
1 answer
NativeScript exaption when im adding a { provide: HTTP_INTERCEPTOR .....}
hey guys !
this is what im working on :
https://github.com/jonny720/do-here-client/blob/master/do-here/app/%40shared/services/aute.interceptor.ts
i'm having a problem with the HTTP_INTERCEPTOR i wanna build interceptor who is going to add headers to…

Johnny
- 105
- 2
- 14
1
vote
1 answer
Providers can't resolve an other provider in constructor's parameter
I'm developing a ionic v3 app :
I declared all my providers but one of them can't be resolve in two others providers
I got this error :
Uncaught Error: Can't resolve all parameters for DialogueMetier:([object Object], [object Object], [object…

Nico Baudon
- 57
- 1
- 10
1
vote
0 answers
Conditional providers in angular module throws AOT error
I want to push a provider to my list of providers only if browser is IE.
I tried like
const IE = detectIE();
providers: [abcService,
xyzService,
(IE) ? [{provide: EVENT_MANAGER_PLUGINS,
useClass:…

Hacker
- 7,798
- 19
- 84
- 154
1
vote
0 answers
angular 2+ get location from within a provider
I have just started trying to learn Angular. I was familiar with Angular JS and decided to take the plunge into 2+. Apparently, I got started with Angular 6. That was quite a jump.
I am trying to get some information from my API when the application…

fizch
- 2,599
- 3
- 30
- 45
1
vote
1 answer
Issue in providing Interceptor and dependent Custom Service in same module
I have AppModule snippet where I am injecting token handling interceptor
@NgModule({
imports: [
BrowserModule,
HttpClientModule
],
declarations: [AppComponent],
providers: [
AuthService,
{
provide: HTTP_INTERCEPTORS,
…

Sumit Ramteke
- 1,487
- 1
- 16
- 39
1
vote
1 answer
injected service not executing correctly despite being provided at module level angular 4
I have a service called VenueAdminInceptionService
import {Subject} from 'rxjs/Subject';
import {Observable} from "rxjs/Observable";
import {VenueAdminInceptionModel} from '../../models/venueadmininceptionmodel/venueadmin.inception.model';
export…
user6781560
1
vote
1 answer
errors.ts:42 ERROR Error: Uncaught (in promise):
Am having this error on my chatservice i can't solve it
Here's the error
here is the actual code of my chatservice
import{Injectable} from '@angular/core';
import {Subject} from 'rxjs/Subject';
import {Observable} from 'rxjs/Observable';
import *…

Abdallah Abdillah
- 1,189
- 13
- 26
1
vote
1 answer
Angular UrlResolver is not overridden by custom provider
I have an Angular application in which I'd like to use a custom UrlResolver provider in order to add some cache breaking logic, as seen in this question (https://stackoverflow.com/a/43289767/868914).
However it doesn't seem that I can override the…

George Harris
- 194
- 1
- 2
- 11
1
vote
0 answers
Angular (2/4) something similar to Symfony (2/3) tagged services
I'm trying to achieve something similar to Symfony's tagged services.
What is it going to be used for:
I want to reproduce "voters" into my front-logic (yes, im aware that frontend technology is not going to give me 100% sure of real permission,…

kptLucek
- 31
- 7
1
vote
1 answer
Why does my Angular2 control need to be included as a provider?
I am trying to learn Angular and have run into what is probably a very simple problem.
I have written a child component for doing grid paging called "PageSelectorComponent". This component just takes a total record count and calculates and displays…

David Chu
- 11
- 2
1
vote
1 answer
angular 4 http interceptor: Factory not getting called
I am trying to add interceptor to my angular 4 app.
I have following interceptor code
import { Injectable } from '@angular/core';
import { ConnectionBackend, Headers, Http, RequestOptions, RequestOptionsArgs, Response } from '@angular/http';
import…

nikhil mehta
- 972
- 15
- 30
1
vote
0 answers
angular-strap decorating $select provider
I am using mgcrea.ngStrap and i am trying to change some methods in $select provider.
Is there any way to decorate some functions inside this provider?
To be precise here is the code of the provider (i removed all unnecessary methods and data) :
…

tony
- 131
- 1
- 1
- 9