2,084 questions
0
votes
1
answer
34
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
29
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
63
views
How to inject a Service inside ApplicationConfig?
How to inject a Service inside ApplicationConfig?
export const appConfig: ApplicationConfig = {
providers: [
provideRouter(appRoutes),
provideTransloco({
config: {
...
0
votes
2
answers
41
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
38
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
291
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
252
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
66
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
137
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
200
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 ...
2
votes
1
answer
894
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
35
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
153
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
124
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
267
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
77
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
393
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
255
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 -> ...
1
vote
1
answer
95
views
How to Properly Manage Service Destruction in Angular with Route-Level Providers?
I'm working on an Angular project where I'm lazy loading a module and providing multiple services at the route level. My expectation was that these services would be destroyed when the user navigates ...
0
votes
0
answers
29
views
How does my Service plug into my Child Component
I'm an old hand at AngularJS, and now cutting my teeth once again on Angular, with the new standalone (incase its relevant) and considering how to hook my data from my firebase service to my display ...
0
votes
1
answer
449
views
Angular component not loading in the browser due to Observable subscription
In this component when I call the getCurrentSalahOrIqamah function in the ngOninit so my component is not loaded in the browser. and keep stuck.
I tried with both lazyloaded eager loaded component but ...
0
votes
1
answer
2k
views
How to share data between components using service in Angular 17
I want to share a value between all my components (which are not necessarily related) using a service.
There are a number of examples online but it doesn't work for me, I don't know what I did wrong.
...
0
votes
0
answers
30
views
What is the recommended approach for initializing and releasing mutable services based on subdomains and routes in Angular?
We use Angular for our application. We have some kind of mutable (state) services that we call them Repository services. For example, PortfolioRepository, where we call an API to get all portfolio ...
1
vote
3
answers
626
views
Angular Window Resize performance
I'm creating an Angular responsive app where I have more than 10 breakpoints in which I have to group the elements in different containers. Having this in mind I believe that I can't get advantage of ...
0
votes
0
answers
37
views
How can I use angularjs $parse service in Angular?
I'm trying to migrate the $parse function in angularjs to angular, but I don't know how to convert it.
var getters = [];
angular.forEach(expressions, function parseExpression(expression) {
...
0
votes
1
answer
36
views
Unwanted AutoUpdate Takes me to Another Rote
I have a component watchlist component that is supposed to call a method from another component search-home-component when a click event occurs. here is my watchlist component:
<p>watchlist ...
0
votes
1
answer
53
views
Who has the responsibility to instantiate "background" services in Angular?
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 ...
1
vote
1
answer
85
views
Angular Reactivity and Communicating via Services
Almost exclusively if you search for examples of cross-component communication via services the examples are using RxJS inside the service (could be signals now too). However it doesn't seem like this ...
0
votes
1
answer
43
views
How to create a html select, triggering related Angular service method calls on select change
I'd like to create an Angular component containing a dropdown/select where the user can select between several methods from several services, and the selected method will be called on selection change....
4
votes
1
answer
850
views
How to identify the correct Angular signal with effect()?
The signals in Angular are pretty nice. However I'm struggling with handle multiple signals. In a very simplified example is a service ExternalController that defines two signals controller1 and ...
0
votes
1
answer
124
views
error NG8002: Can't bind to 'owlDateTimeTrigger' since it isn't a known property of 'input'
HI i need to add owlDateTimeTrigger in angular 16 microfrontent but it show error. please check the below screenshot.
Code:
<ng-template #childtemplateSheduleTime let-data>
<input [(ngModel)]...
0
votes
2
answers
3k
views
error NG2012: Component imports must be standalone components, directives, pipes, or must be NgModules
If we add some dependency in angular standalone component and app.module then show this error:
error NG2012: Component imports must be standalone components, directives, pipes, or must be NgModules
0
votes
2
answers
913
views
How to add an angular pipe in a service in Angular 17?
I have 2 components that have the same function inside calls the pipe currency, as a component I can instantiate it correctly.
I want to move these two functions to a service and call it, but I can’t ...
1
vote
2
answers
428
views
Angular service not initialized in lazy loaded component
I have an Angular app that has a component with a table. When I click on the table I want to change views with the router and pass that row to the other component. I'm using a shared injectable ...
1
vote
1
answer
495
views
@angular/core/@Inject() result with an error : NullInjectorError: No provider for
I found several posts on that topic but I'm obviously missing something.
My main goal is to use an Injectable that requires a parameter.
I found that the way to go is to use the decorator @Inject.
You ...
1
vote
1
answer
65
views
Data from Angular Service is not provided in template after passing from service
After creating an API Backend with Django i tried to get an Angular Component to display the data provided to create a list of all fetched datasets.
I was able to get an test in service.spec.ts ...
2
votes
1
answer
1k
views
How to include Angular services with lazy-loaded standalone component routes?
I have an Angular 17 application using standalone components, the initial routes are set up like so in app.routes.ts
export const appRoutes: Array<Route> = [
{ path: '', redirectTo: '/...
0
votes
2
answers
66
views
Angular Service - Why is the primitive value not updated?
I'm figuring out how Angular Services work, but I don't understand why the heroCounter (number) doesn't update correctly while the hero array does. For instance, as I add a new dummy hero I expect the ...
1
vote
3
answers
2k
views
Angular 17 not rendering a component with Socket.io
I have the following Angular component, whose only property is an instance of ConnectionService service:
import { Component } from '@angular/core';
import { CommonModule } from '@angular/common';
...
1
vote
1
answer
493
views
I got a problem with a service in Angular 16
I'm working with Angular 16 for a project that involves using balkan family tree , but I got stuck with a problem in a service
This is the function where it emits the value, is using HttpClient from ...
0
votes
2
answers
262
views
Can a resolver use the same service instance form another module except the AppModule in Angular?
I have a lazy loaded module with all it components declared and routes added in RouterModule.forChild()
but some of these routes have their resolver that will prefetch some data And call a service to ...
0
votes
1
answer
223
views
Share service instance between multiple components
Suppose you have 3 lazily loaded components, A, B, and C – this means they are not loaded eagerly, as soon as possible, but depending on some condition (e.g., a back-end response).
Is it possible to ...
2
votes
2
answers
751
views
Angular service data caching with RxJS
I have an angular service that is specific to a type of data in my project. Right now it just passes everything straight trhough to a generic data service that handles the HTTP requests.
@Injectable({
...
0
votes
2
answers
252
views
Where to provide angular services for storing data
I want to use ngrx component-store/service with a subject in my application, however I am in a situation where I am not sure whats best. I hope you can guide me in the right direction. (The following ...
1
vote
0
answers
219
views
'ng generate service' command says 'Nothing to be done'
I want to create a service service file. But when I am giving
ng generate service my-service it returns 'Nothing to be done'.
There doesn't exist a file with the same name in my project folder.
...
0
votes
0
answers
31
views
Angular service call to .Net api controller not working
I have one angular solution where service method calls api controller. but it is giving error. Code is given below :
user.service.ts
getMonthlyData(date: string): Observable<UserProfile> {
const ...
0
votes
0
answers
74
views
How to load paypal button component button twice from two different parent component in angular
am using PayPal component to load PayPal button in shared component so trying to access from two parent components, but unfortunately it shows the button in first component. If i tried with set ...
0
votes
1
answer
49
views
How to wait for the information to be received by the service and then use it in angular
I wrote a service that receives permissions data from the API, and based on these permissions, I show or hide parts of the menu. But I want it to show or hide parts of the menu only after receiving ...
0
votes
1
answer
260
views
Scrolling to a component on click
Let's say I have a landing page with a button, and I want that when I click on that button I get redirected to another page that has multiple components (imagine a page with a lot of small blocks, ...
0
votes
1
answer
980
views
Angular loading mat-spinner not firing
I am wondering why my loading spinner is not firing, and I think it may be due to my confusion in regard to my LoadingService at the app level, and my LoadingService as a provider at the page level.
...