2,087
questions
0
votes
2
answers
37
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
31
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
142
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 ...
0
votes
1
answer
165
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.
...
1
vote
1
answer
64
views
BehaviorSubject does not update when called from app.config.ts
TL;DR - Solution:
I was using subscribe rather than pipe the value to the APP_INITIALIZER. Also, I was registering twice UserService, once as a singleton (which it should be) and second time within ...
3
votes
2
answers
93
views
2 observables declared with takeUntilDestroyed, when combined, require additional takeUntilDestroyed?
I'm using takeUntilDestroyed to manage my subscriptions and avoid memory leaks. Within an injection context, variable declaration, I will have something like this
mySubject1$ = new BehaviourSubject<...
1
vote
2
answers
168
views
Why NullInjectionError problem not solved by adding ProvideHttpClient() in app.config file of Angular 18
I am trying to fetch data from the backend of my application. The data fetching works well with combination of promise and fetch function. But when I tried to implement it using HttpClient service it ...
1
vote
1
answer
453
views
Angular Standalone - How to Inject Service into Service
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 ...
1
vote
1
answer
32
views
Getting "Property info and results doesn't exist on type Response"
I have created a service to make an HTTP request to fetch users. But, I'm getting an error while modifying the API response. I tried everything and can't figure out the solution. Here's is the image ...
0
votes
2
answers
128
views
Using async/await with a service call
I'm having trouble understanding how to use async/await in this scenario. I have a function GetAdditionalProducts() that calls a service and returns a result. I call that function elsewhere where I ...
0
votes
1
answer
73
views
Not able to retrieve Angular signal from service
I am trying to use a service to be able to put the selected division object in a service and then retrieve it in the detail form. the code for the service is:
private currentDivision = signal<...
0
votes
1
answer
237
views
Handling Checkbox Interactions and Pagination in Angular Table
I am working on an Angular application that includes a table with pagination implemented on the server side. One of the columns in the table contains a checkbox that acts as a "Select All" ...
0
votes
1
answer
72
views
Angular lazy loading component and service
May you explain me some fact? I have this code
sharedservice.ts
@Injectable({
providedIn: 'root'
})
export class SharedService {
id = (new Date()).getTime();
}
main.ts
export const ROUTES: Route[...
2
votes
1
answer
285
views
DOCUMENT injection token for SSR angular service causes NotYetImplemented error
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,...
0
votes
1
answer
211
views
Angular NullInjectorError: No provider for JwtHelperService in Standalone Component
I just started with Angular and I encounter this error when using JwtHelperService:
"ERROR NullInjectorError: R3InjectorError(Standalone[_LoginComponent])[_AuthService -> _AuthService -> ...