Questions tagged [angular-providers]

The service providers are constructor functions. When instantiated they must contain a property called $get, which holds the service factory function.

angularjs doc

173 questions
2
votes
1 answer

How to make an HTTP call from useFactory function during provider configuration in Angular?

I have the next provider configuration { provide: APP_INITIALIZER, useFactory: initializeKeycloak, multi: true, deps: [KeycloakService], }, How to make an HTTP call from useFactory function…
2
votes
0 answers

Angular 8 how to change the providers of material date picker according to selected material tab?

I have 2 material datepickers in my component. Each one of them is in different mat-tab. The date picker of first tab should be as MM/YYYY, the second one should a normal date DD/MM/YYYY. The first step of changing the value of datepicker to MM/YYYY…
alim1990
  • 4,656
  • 12
  • 67
  • 130
2
votes
1 answer

Why does ', providers: [TravelService] ' in a component prevent the RXJS Behaviour subject from sharing data across components?

@Component({ selector: 'app-overview-travel', templateUrl: './overview-travel.component.html', styleUrls: ['./overview-travel.component.scss'], providers: [TravelService] }) The code above prevented data from my shared data service (using…
2
votes
1 answer

Angular got Circular dependency detection WARNING when using a Service with providedIn: LazyModule

I'm on Angular 8, simple app, with a Lazy loaded module and a service providedIn: 'root': everything's working. Now I'd like to provide the service in the LazyLoadedModule, so that the service is provided only when the lazy loaded module is…
user2010955
  • 3,871
  • 7
  • 34
  • 53
2
votes
0 answers

How to access data while using Factory provider in angular4?

when i have a provider like this { provide: SaModelService, useValue: 'foo@yahoo.com' } i am able to get the value by just using like this in the component @Component({ selector: 'app-root', templateUrl: './app.component.html', styleUrls:…
Lijin Durairaj
  • 3,341
  • 11
  • 31
  • 50
2
votes
2 answers

No provider for function (){}! in angular 4

I am running the following command for prod build ng serve --prod --env=qa after running this command i don't get any errors but once i run localhost:4200/ in the browser I get the following error Uncaught Error: No provider for function (){}! at b…
nethra gowda
  • 290
  • 1
  • 4
  • 23
2
votes
2 answers

Angular 2 - Error: No provider for FormControl

I writing a library for the community, which needs access to the form control and listens on the value changed. Here's how I did previously when using angular 2.3 and 4.0. export class ValidationMessageDirective implements OnInit { …
2
votes
1 answer

Angular creating named instances of providers

In Angular I have a service to access a cache. The service roughly works like this (but with a lot more asynchronous behavior). @Injectable() export class Cache { cache : CacheTable; constructor( protected name : string ) { …
Raven
  • 1,453
  • 3
  • 18
  • 29
2
votes
2 answers

Use same selector in 2 components but different template syntax?

I have 2 components (DetailPage, ListPage) with below template : {{ text }} {{ content }} {{ text }} {{ content…
Thien Hoang
  • 625
  • 3
  • 12
2
votes
1 answer

Angular 2 No Provider or DI error (Uncaught (in promise): Error: No provider ...)

I am getting the following exception in angular 2. EXCEPTION: Uncaught (in promise): Error: No provider for SettingsService! Error: DI Error at NoProviderError.BaseError [as constructor]…
2
votes
1 answer

different kind of provider configurations in angular

Learning angular from different resources on internet makes really confusing. everyone using different kind of patterns to write functions .Kindly throw some light on this .provider concept I have tried .provider with 4 different pattern and all are…
xkeshav
  • 53,360
  • 44
  • 177
  • 245
2
votes
1 answer

Angular2 Provider that depends on other Providers

I have several modules within my Angular2 application, that provide Services and Configuration. Now I'd like to include the @ngrx/store which collects the available reducers from my modules. Here's the bootstrap code: import {OpaqueToken} from…
Benjamin M
  • 23,599
  • 32
  • 121
  • 201
2
votes
2 answers

Angular Dependency Injection for Custom Provider $injector:modulerr

I'm struggling to get a custom provider to work with dependencies injected into it. I'm following this blog and here is my latest version of the provider in my attempts to get it working. define([ 'angular', 'ngRoute', 'require' ],…
2
votes
2 answers

Unknown provider: $state

Hello i'm having some issues with dependency injection via the $injector service. I'm new to angular so i'll explain how i see this from an IoC container point of view. First off the issue : $injector is unable to resolve $state. core.js…
eran otzap
  • 12,293
  • 20
  • 84
  • 139
1
vote
1 answer

Angular APP_INITIALIZER deps doesnt work - service is undefined

I am trying to use APP_INITIALIZER to do initial call for env values but for some reason service that have this function is undefined during runInitializers. Function is in our external library. I have tried to do this in library with the…
1 2
3
11 12