angular-services Questions

5

Solved

I have an issue, I want to rewrite my app code and change main module to main root standalone component pointed in main.ts. All works fine but I have an issue with HttpClientModule. I am using Http...

5

In creating dynamic components in Angular 2, I found out that this process requires ViewContainerRef in order to add newly created component to DOM. And in passing @Input and @Outputto those dynami...
Imprinting asked 31/8, 2016 at 5:13

3

I had a discussion today where some of my colleagues said that they inject their Angular services like that: constructor(readonly language: I18nService) They said they do this because it prevent...
Iberian asked 25/2, 2019 at 17:43

7

While working on a program that I am facing an issue with, constructor and its dependency injection from its child class. DataService: A service class which has all the CRUD operation at one place...
Goodwife asked 22/3, 2020 at 15:55

1

I have an angular app upgraded to angular 9 and I am using angular element in it which is also upgraded to angular 9. I have a service module (angular 9) which I am importing in my angular app. My ...
Batsheva asked 15/6, 2020 at 22:8

6

Solved

I have the following service: import { Injectable } from '@angular/core'; import { MenuItem } from './../classes/menu-item'; import { ITEMS } from './../static-data/items-list'; @Injectable() e...
Viridian asked 1/2, 2017 at 12:46

2

Solved

i am using angular2-toaster in my angular app it is very simple, you define toaster container in the template of component <toaster-container></toaster-container> and you use to...
Joselynjoseph asked 18/9, 2017 at 12:0

4

Solved

In Angular 9 the injectable decorator option providedIn has a new value called any. What is the difference between root and any? Is a service considered a singleton in the case that I use any? @I...

7

I need to get the status code of the following http call and return it as a string //This method must return the status of the http response confirmEmail(mailToken):Observable<String>{ ret...
Werby asked 28/4, 2017 at 14:49

8

Solved

In an angular application we have ngOnDestroy() lifecycle hook for a component / directive and we use this hook to unsubscribe the observables. I want to clear / destory observable that are create...
Digitalize asked 26/8, 2017 at 19:27

3

Solved

I was doing the angular Tour-hero project(replaced Hero with 'User'). There when I made the Hero(User) and Hero-detail(User-detail) separate and when I tried to access the details, it is not showin...

3

Solved

In Angular, I have a service that has few things injected through the constructor(...). However that service is also at some place created by calling the constructor. Therefore, adding another serv...
Champaign asked 20/7, 2017 at 21:41

5

Solved

I'm attempting to use DomSanitizer to sanitize a dynamic URL within a Component using I can't seem to figure out what the correct way to specify a Provider for this service is. I'm using Angular 2...

4

Solved

I have read many articles about Angular folder structure. It is still not clear to me where do we put component services. Shared services between components are put under shared. But what about a s...
Bigamous asked 10/8, 2018 at 4:42

4

Solved

Background We're building an Angular2 app, and are accumulating a lot of specific services relating to one module. All these services are loosely coupled to a Subject<Type> event system in t...
Phyllisphylloclade asked 19/12, 2016 at 3:4

3

Solved

TLDR: How do I use one instance of an Angular (6) service for one set of (instances of) components (and directives) and another one for another set of the same components. Or with more informati...
Concordance asked 9/8, 2018 at 20:6

2

Solved

In Angular 2, I have my routes defined in app.module.ts: const appRoutes: Routes = [ { path: '', component: HomeComponent, }, { path: 'admin', component: AdminComponent, } ]; I also hav...
Inhalator asked 26/9, 2017 at 14:59

4

Solved

I have a problem trying to unit test an angular service. I want to verify that this service is properly calling another service that is injected into it. Lets say I have this ServiceToTest that in...
Arcadia asked 22/12, 2017 at 8:48

7

Solved

So, I was trying to get the solution of this problem. But, somehow I am unable to do so, May be because of the lack of knowledge in angular 5. This is my service: GetCurrentUserData(): Observable&...

7

I'm expecting Angular to wait until my loadConfig() function resolves before constructing other services, but it is not. app.module.ts export function initializeConfig(config: AppConfig){ return ...

2

The redirectTo property isn't working in my Angular 2 app. I have the following routes in my app.routing.ts: const routes: Routes = [ { path: '', redirectTo: '/page/1', pathMatch: 'full' }, { pa...
Vrablik asked 30/10, 2016 at 23:52

4

I was working on a project and came across a service which does not have the @Injectable() decorator, and works fine. Till now , I was under the impression that in angular if we want to implement D...
Bejarano asked 30/11, 2020 at 12:48

3

I have a service to pass data between components and when called it works but when i reload the service data gets reset.So when i searched on reload the memory is reset so is there a way to persist...
Blunk asked 27/1, 2018 at 6:49

4

Solved

Angular dependency injection let you inject a string, function, or object using a token instead of a service class. I declare it in my module like this: providers: [{ provide: MyValueToken, useV...

3

Solved

I have an Angular 5 application, and I'm attempting to use a Google OAuth login to get a username and then set that username in a service to be used as the logged in user. Before I added the login ...
Spada asked 26/10, 2018 at 10:20

© 2022 - 2025 — McMap. All rights reserved.