Skip to main content
Stack Overflow for Teams is now Stack Internal: See how we’re powering the human intelligence layer of enterprise AI. Read more >
Filter by
Sorted by
Tagged with
0 votes
1 answer
120 views

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
146 views

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
2k views

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

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
263 views

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
117 views

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
53 views

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
344 views

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
109 views

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

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
121 views

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
150 views

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
628 views

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
6k views

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
75 views

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
2 votes
1 answer
159 views

I wasn't able to solve it. I'm counting on your help. I have an Angular application and a library. In the library, I have a service where I inject HttpClient. I set HttpClient as a provider in the ...
Tomasz Jaworski's user avatar
6 votes
2 answers
2k views

Using Angular SSR, I would like to access a server-side value in my app.component. Here is my server-side route: app.get('**', (req, res, next) => { const { protocol, originalUrl, baseUrl, ...
Brandon Taylor's user avatar
3 votes
2 answers
210 views

Recently, Angular put in place a migration to replace constructor-based injection with inject function. In most of the cases, it is straightforward and it clearly has benefits: // before @Injectable({ ...
fservantdev's user avatar
1 vote
2 answers
617 views

How to inject a Service inside ApplicationConfig? export const appConfig: ApplicationConfig = { providers: [ provideRouter(appRoutes), provideTransloco({ config: { ...
Maksat Madeniyetov's user avatar
1 vote
0 answers
73 views

I want to dynamically create the injector for embeddedView and for that purpose I use Injector.create() method: const myInjector = Injector.create({ providers: [ { ...
Raziel's user avatar
  • 140
1 vote
1 answer
52 views

My Angular app works in Chrome. export interface UserService { me(): Observable<Response<User>>; } export const UserServiceRef = Symbol(); ---- providers: [ { provide: ...
Conde's user avatar
  • 951
0 votes
2 answers
295 views

I've: service DataLoader who read/write data in DB. service Report who instances DataLoader using inject standalone component who inject DataLoader and Report too. At this point, only one instance of ...
Jeferson Fillipe's user avatar
0 votes
0 answers
76 views

I have a component, which I will build using my custom builder. This builder builds my component in ESM format. My component code (which will be built) is a simple standalone component which imports ...
ruddnisrus's user avatar
4 votes
1 answer
5k views

I'm a longtime Angular dev now trying to learn the standalone version. How do I inject a service into another service without a providers array in the NgModule. Is my only choice using providedIn in ...
emery.noel's user avatar
  • 1,223
0 votes
1 answer
121 views

I have an Angular directive (LevelDirective) designed to determine its level based on its parent's level (i.e. if parent has level 1 => I should have level 2). It uses a standalone LevelService to ...
Alexandru Tatarciuc's user avatar
1 vote
1 answer
95 views

I'm working on an Angular service that fetches rules from a secondary cart and updates a BehaviorSubject to manage the state. However, my subscribers are not receiving updates even after the state is ...
Manish Patidar's user avatar
2 votes
1 answer
1k views

I have an Angular SSR app with a service that references document. I use the DOCUMENT injection token to provide document as a DI. Here is the repo: https://github.com/JakeLo123/ng-ssr import { Inject,...
Jake Loew's user avatar
  • 225
2 votes
1 answer
507 views

I am creating an angular library that has a root-level service class that references document. I'd like to add SSR support, but of course document is not defined in SSR context. It seems that Angular ...
Jake Loew's user avatar
  • 225
0 votes
1 answer
62 views

I read several articles about the two types of injector hierarchies in Angular - the ElementInjector and the EnvironmentInjector hierarchies, and what type of dependencies they provide, and how when ...
atiyar's user avatar
  • 8,385
1 vote
1 answer
210 views

Given the following example on stackblitz @Injectable() export class LogService { sayHello() { console.log('Hello World !'); } } @Component({ selector: 'app-child', standalone: true, ...
Olivier Boissé's user avatar
0 votes
1 answer
99 views

I'm following the Angular documentation for service workers (https://angular.io/guide/service-worker-communications). The page lists a series of examples of services used to handle service worker ...
maja's user avatar
  • 830
1 vote
1 answer
1k views

I want to 'attach' a signal store to one of my components. I intend to provide this at component level and not at the root, as the state is specific to that component. However I like to use route ...
royneedshelp's user avatar
0 votes
3 answers
110 views

I want to override the function navigate(commands: any[], extras?: NavigationExtras): Promise<boolean> of Router to always set queryParamsHandling to true in the NavigationExtras. Therefore I ...
basti394's user avatar
  • 445
1 vote
0 answers
596 views

I am getting a NullInjectorError error when I use an Angular component in a federated module (via remoteEntry.js), while it is working well in a standalone Angualar app. It is (and has to be) a ...
Jan Dolejsi's user avatar
  • 1,561
1 vote
1 answer
663 views

I am authoring an Angular library. It contains a service, which runs initialization logic in the constructor that is required for the library to work properly. I have set up the library module with a ...
JSON Derulo's user avatar
  • 18.8k
1 vote
1 answer
1k views

I'm trying to read a query param on a given route in the canActivate function and if it's not there, show a modal saying that it's not going to work ok. When I think more about this, because it's only ...
maxime1992's user avatar
0 votes
0 answers
392 views

Injecting a different service in an interceptor is giving the above mentioned error even though Iam not importing httpClient into the the service. logger.interceptor.ts import { HttpInterceptorFn } ...
Vivek Dama's user avatar
3 votes
2 answers
11k views

I'm trying to list all the categories from my asp .net application, and im receiving this nullinjector error: ERROR NullInjectorError: R3InjectorError(_AppModule)[CategoriaServiceList -> ...
Breno Van Dall's user avatar
1 vote
0 answers
95 views

I have a BadgeComponent with this template: <draw-circle [position.x]="position.x" [position.y]="position.y" [resolution]="20" [radius]="2" [color]=...
jlang's user avatar
  • 1,063
1 vote
0 answers
44 views

I have a scenario where I want to share a service within a NgModule. but at the same time I want to keep its instances usage separate. stackblitz in the stackblitz, you can see that I have a hover-...
Mohammad Hossein Amri's user avatar
7 votes
4 answers
31k views

I am using Angular v16 and I have the following config that needs to be included in app.module. What is the best way to inject appConfig in app.module? It works if I include them directly inside app....
SKL's user avatar
  • 1,493
2 votes
0 answers
65 views

My application displays data about different kinds of business objects in the same standard component. That is, let's assume there is an Angular component type EditorComponent<T extends object>. ...
F-H's user avatar
  • 1,213
1 vote
0 answers
205 views

tl;dr: How does Angular know that an injection token passed to injector.get corresponds with an injection token of a particular provider? According to the Angular documentation, an InjectionToken can ...
F-H's user avatar
  • 1,213
0 votes
1 answer
1k views

I'm trying to convert my class-based resolver to a functional one. Injecting NGRX store is not working. export const loadCategoriesParentCategoryCodeResolver : ResolveFn<boolean> = ( route, ...
Richard77's user avatar
  • 21.9k
0 votes
1 answer
301 views

Now I inject my extra components to my main component's root level in a directive, with this approach: @Directive({ selector: '[my-controls]', }) export class MyControlsDirective implements OnInit, ...
David Gregor's user avatar
7 votes
1 answer
3k views

Im faced with a term called "Injection context", and trying to figuring out what it actually is. Coz in angular we have following things that somehow related with injection context (listed ...
Yurii Nadilnyi's user avatar
1 vote
0 answers
131 views

I'm trying to use ngx-permissions to manage my app permissions. My app is depending on a library to share some features to different apps and the permissions will be loaded by this library. The ...
Gopalakrishnan R's user avatar
0 votes
1 answer
116 views

Given a multi injectable defined like below, without any providers, I would expect the injected list to be empty, but in reality it is null. Is there a way to inject the value as [] instead of null if ...
Ákos Vandra-Meyer's user avatar
0 votes
0 answers
53 views

so i have started to learn more about Dependency Injection. And as it was written in Docs, i expect that if i have 2 separate modules and both of them have their own provider in provider array. I'll ...
Iceneo's user avatar
  • 61
0 votes
2 answers
126 views

(How) is it possible to configure injectors to use a class based on some data available at bootstrap? I have two implementations for interfacing with the backend, (for simplicity, let's say over http ...
Ákos Vandra-Meyer's user avatar