Skip to main content
0 votes
1 answer
105 views

Angular 19 ApplicationConfig use Configuration in factory

In GitOp I want to replace config.json for each environment and with this internal app I want to keep it as simple as possible (e.g. no ngrx) My problem is that config.json is loaded in a ...
furion2000's user avatar
0 votes
1 answer
128 views

How to pass a default value with @Optional in Angular 20?

In Angular 20, how can we inject an optional InjectionToken with a default value? In Angular <20, I used to do it as follows: constructor(@Optional@Inject(FOO) private foo = true){}
Raphaël Balet's user avatar
1 vote
2 answers
1k views

How to use new Angular 20 inject syntax with

I'm using @Inject(String) to enable giving config at the instantiation of my service. Here's the code: const httpLoaderFactory: (http: HttpClient) => TranslateHttpLoader = (http: HttpClient) => ...
Raphaël Balet's user avatar
0 votes
0 answers
17 views

How could mimic the module experience with Angular standalone components?

Since it looks like the modules in Angular are near the end of their life, and stand-alone components are the future, how can we provide dependencies in the same way as when a module is used? With ...
presian's user avatar
0 votes
2 answers
238 views

How can I inject an Angular service into a custom class?

I have this custom class called SortState that represents sorting and paging on a table of records. Now I want to make that class talk to a service that displays a loading indicator. Apparently you ...
Luke Bretscher's user avatar
1 vote
1 answer
106 views

Angular Firebase Error: "NullInjectorError: No provider for Firestore2!" in Standalone Component

I'm working on an Angular standalone component using Firebase, and I'm encountering the following error: ERROR NullInjectorError: R3InjectorError(Standalone[_AppComponent])[_FirebaseService -> ...
yasiru sahanpathi's user avatar
1 vote
1 answer
52 views

Functional style interceptors - How to provide them with dependencies

Imagine the situation where you provide any lib to client. Simple scenario, spinner interceptor which needs spinner service. In old way it was possible to: providers: [ { provide: ...
turtle's user avatar
  • 41
1 vote
2 answers
309 views

Angular standalone:chain multiple functions in provideAppInitializer

In my Angular application (version 19), I have a provideAppInitializer like this: export const appConfig: ApplicationConfig = { providers: [ ... provideAppInitializer(intializeAppFn), ...
shamon shamsudeen's user avatar
1 vote
1 answer
102 views

Error NG2003: No suitable injection token for parameter 'exportAsService' – ngx-export-as issue in Angular component reuse [closed]

I'm working on an Angular project and using the ngx-export-as package, which was already installed and working fine in some of my components. However, when I tried to use the same ExportAsService in a ...
Lojini's user avatar
  • 166
1 vote
1 answer
55 views

Restructuring a super call in a constructor to use the 'this'

I have the following service: import { ENVIRONMENT_TOKEN } from '@reg/environment/domain' @Injectable({ providedIn: 'root' }) export class RegStore extends ImmutableStore<TRegState> { #env =...
st_clair_clarke's user avatar
2 votes
1 answer
114 views

How to provide a HostAttributeToken in Angular tests?

I recently discovered the HostAttributeToken in Angular (see docs) to provide static attributes for a component. The following example works fine: import { Component, HostAttributeToken, inject } from ...
kerosene's user avatar
  • 921
0 votes
1 answer
146 views

NullInjectorError: R3InjectorError

I'm working in a personal project, using angular, but I receive the following error all the time: NullInjectorError: R3InjectorError(Environment Injector)[_HttpClient->_HttpClient]: ...
Semicolon's user avatar
  • 137
2 votes
1 answer
621 views

convert APP_INITIALIZER code to newer provideAppInitializer syntax

I have a piece of code from an angular application like below, { provide: APP_INITIALIZER, deps: [...config.mockApi.services], useFactory: () => (): any => null, multi: true, } ...
Arman's user avatar
  • 21
5 votes
2 answers
5k views

Angular 19 Standalone Component Error: "No provider for _HttpClient" Despite HttpClientModule Imported

I am working on an Angular standalone application and encountering the following error when using HttpClient in my DataService: ERROR Error [NullInjectorError]: R3InjectorError(Standalone[...
user84's user avatar
  • 905
1 vote
1 answer
72 views

Angular DI for standalone components with importing module on parent component and child component (NullInjectorError: R3InjectorError)

Given the following structure: a parent standalone component named AppComponent a child standalone component called TableComponent, which should be a wrapper for a generic table TableComponent ...
kerosene's user avatar
  • 921

15 30 50 per page
1
2 3 4 5
10