2,085 questions
-1
votes
1
answer
66
views
Lifecycle Management: Safely Unsubscribing from HttpClient in Root-Provided Angular Signal Services [closed]
I am implementing a modern state management pattern in Angular (version 16+) where a dedicated service acts as a state facade, integrating traditional RxJS asynchronous operations with the new Signals ...
0
votes
0
answers
22
views
Angular19 error no provider when service provided in imported NgModule
I migrated my project from Angular15 to Angular19. I am running mixed mode for standalone components where only AppComponent is standalone whereas all other components are standalone:false.
I am using ...
0
votes
0
answers
56
views
Angular 19 SSG: ngOnInit not executing during static generation, data not visible in initial HTML
I'm using Angular 19 with Static Site Generation (SSG) and my ngOnInit method is not executing during the build process. The API calls are only made when clients load the page in the browser, ...
3
votes
3
answers
193
views
Trying to inject the DecimalPipe into an Angular service
I understand how to use the DecimalPipe in an Angular 20 HTML template, while importing it in the component code.
However, I cannot figure out how to use the DecimalPipe in an Angular service.
I keep ...
1
vote
2
answers
150
views
How to persist and restore page settings in Angular when navigating between routes?
In my Angular application, users can configure settings on a particular page (e.g., filters, view preferences, etc.). When the user navigates to another route and then returns to the original page, I ...
2
votes
3
answers
61
views
Synchronize call to 2 methods
In a component (or service) I call to Main method which calls to 2 other private methods.
export class MyService
{
private Stage1 (N : number)
{
console.log ('-->Stage1');
for (...
1
vote
1
answer
770
views
Mocking injected provided service in standalone angular component AND NOT IN ROOT for karma jasmine tests
FYI: I am using angular 19.1.0 with karma
Let's assume we have this service and component
// NOT PROVIDED IN ROOT!
@Injectable()
export class TestService {
getData(): string {
return 'this is ...
1
vote
1
answer
61
views
Circular dependency Error in /turbo_modules/@angular/[email protected]/bundles/compiler.umd.js (2845:21) Can't resolve all parameters for BService: (?)
A-Service.component.ts
` import { Injectable, Inject } from '@angular/core';
import { BService } from './BService';
@Injectable({
providedIn: 'root',
})
export class AService {
constructor(...
0
votes
2
answers
76
views
Empty list is shown after adding a record
I have a page showing a list of items retrieved with an http service, and a button to add a new one. After adding a new one, I navigate programmatically to the first page, but now the service is not ...
1
vote
1
answer
34
views
Using Common Service Variables or Route Parameters [closed]
I have a Angular application, which has multiple components that access the same Service.
I am trying to understand if there is any benefit to switching away from using route parameters to using ...
1
vote
2
answers
656
views
How to inject a Service inside ApplicationConfig?
How to inject a Service inside ApplicationConfig?
export const appConfig: ApplicationConfig = {
providers: [
provideRouter(appRoutes),
provideTransloco({
config: {
...
-1
votes
2
answers
48
views
Angular Singlton Generic Service with dynamic return type
i have this event management service in my angular application.
i want to set the return type of the OnEvent() method dynamiclly and i want to set the type where i inject the service in my components.
...
0
votes
1
answer
94
views
How non-signal values notify angular for updating the component's UI
Custom services in Angular can have either signal based or non-signal based properties. In case of signal based properties, if they update, angular ensures to notify the component (which injects such ...
1
vote
1
answer
1k
views
How can I make an Angular service injectable only within a specific module?
I am trying to create a service in Angular that should only be injectable within a specific module, not accessible outside that module.
I have a service MyService that I want to restrict so it can ...
1
vote
2
answers
873
views
Angular 17: Standalone components and not a root service
How can I provide a service that is not at the root of the application, and use the same instance between several components and other services? Not using providers in routes and not using ng module.
...