Skip to main content
Filter by
Sorted by
Tagged with
3 votes
0 answers
8k views

list of Angular dependency "@angular/common": "~9.1.1", "@angular/compiler": "~9.1.1", "@angular/core": "~9.1.1", "@angular/forms": "~9.1.1", "@angular/platform-browser": "~9.1.1"...
luharatimarap's user avatar
3 votes
1 answer
2k views

I have been reading the angular 9 documentation, and it states you can use the provideIn: 'platform' to share a singleton service across two angular applications, but I was not able to find a good ...
caraie's user avatar
  • 1,104
2 votes
1 answer
782 views

I'm trying to use Angular2 dependency injection but get the following error message: error NG2003: No suitable injection token for parameter 'service' of class 'PaymentService' app.module.ts - ...
Karen Margaryan's user avatar
0 votes
0 answers
46 views

I have the following class (only the relevant part): import { AppInjector } from '@app/shared/utility/app-injector'; import { HttpService } from '@app/shared/services/http.service'; export class ...
ssougnez's user avatar
  • 5,986
0 votes
1 answer
2k views

Im trying to solve the following situation: I have a child component that will be used in multiple parent components but this child component needs to have access to the parent component (namely ...
Amgg's user avatar
  • 117
27 votes
13 answers
68k views

In my Angular 9 app, I have an abstract class: export abstract class MyAbstractComponent { constructor( protected readonly cd: ChangeDetectorRef, ) { super(); } // ... } and a ...
Francesco Borzi's user avatar
1 vote
1 answer
385 views

I would like to refer the providedIn option to an Angular module providing both declarables and dependencies. I created an additional module SharedModule to serve as a sub-module of the lazy module ...
object Object's user avatar
16 votes
3 answers
4k views

I import a modal library of ng-bootstrap in a lazy module. @NgModule({imports: [NgbModalModule]}) This library has a NgbModal service provided in root. @Injectable({providedIn: 'root'}) class ...
Serginho's user avatar
  • 7,530
28 votes
4 answers
25k views

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? @...
Muhammed Albarmavi's user avatar
0 votes
1 answer
958 views

I have added AngularFire to my project. In its readme I was instructed to add the AngularFireModule.initializeApp(...) to the imports of my AppModule In examples people use the environment constant, ...
lidlbobbytables's user avatar
1 vote
2 answers
947 views

The following code works fine in Dev, but not in Prod mode: Module export class SpinnerModule { static forRoot(config?: SpinnerConfig): ModuleWithProviders { return { ngModule: ...
Youness Houdass's user avatar
5 votes
2 answers
7k views

Consider the following InjectionToken for the type Foo: export const FOO = new InjectionToken<Foo>( 'foo token', { factory: () => new Foo() }); Now assume I was crazy enough to aim for ...
Good Night Nerd Pride's user avatar
5 votes
1 answer
339 views

I would like to use dependency injection to swap the implementation of the provider but can't figure out how to make that type safe. @Injectable() class ExampleService { exampleMethod(): string { ...
bogeylicious's user avatar
  • 5,180
2 votes
0 answers
4k views

I have 2 components: A home component and a confirmation component (overlay). When a button is clicked on the home component, it should trigger the confirmation component to open as a Angular CDK ...
tc01's user avatar
  • 181
1 vote
0 answers
34 views

Let's assume I have a Front End App which needs to fetch data from some backend. And let's assume that there are 2 different backend REST APIs implementations available, BackEnd1 and BackEnd2. They ...
Picci's user avatar
  • 17.8k
1 vote
2 answers
3k views

After upgrading from Angular 7 to Angular 8 my pipe stopped to work with error: TypeError: undefined is not iterable (cannot read property Symbol(Symbol.iterator)) 10 | export class APipe ...
Felix's user avatar
  • 4,635
1 vote
2 answers
4k views

Tl;dr: How do I provide a visible component as a dependency for a directive? Naturally the component has to get initialized before the directive, but it has to be the same instance that gets displayed ...
codepearlex's user avatar
2 votes
1 answer
2k views

I am using Angular 8 and I have dynamically created component. I have parent component with the service into providers array. How I can inject the same instance of parent MyService into a dynamic ...
mr__brainwash's user avatar
13 votes
2 answers
10k views

I'm trying to export a constant in angular and I need to set a key whose value will be returned from a service. I tried with following code: This is my user-config.ts file: export const USER_CONFIG = {...
Kedar Udupa's user avatar
2 votes
3 answers
2k views

I have an angular service containing some init code in its constructor. When is this code called, i.e. when is the service created? Already when the service is provided in some module? Or not until ...
Tho.Tra's user avatar
  • 155
13 votes
4 answers
13k views

In my Angular app, I'm trying to use a factory provider in my module: export function getMyFactory(): () => Window { return () => window; } @NgModule({ providers: [ { provide: WindowRef,...
Francesco Borzi's user avatar
0 votes
1 answer
76 views

My goal is to load a configuration file (from assets) which includes settings I need for my http service. Currently I have an APP_INITIALIZER service which loads the file and sets it in the service ...
Dan R.'s user avatar
  • 648
1 vote
1 answer
461 views

Since updating to Angular 8.1 (8.0 worked), I'm getting a circular dependency warning that doesn't really make sense to me. I have an Injectable Service SelectService that is provided in some ...
Thomas Schneiter's user avatar
1 vote
1 answer
2k views

Suppose you have an Angular service (ZombieService) which, for example, monitors an other service. And, ZombieService isn't injected anywhere DEMO The problem is that, when you do not inject a ...
Jeanluca Scaljeri's user avatar
0 votes
0 answers
447 views

I am creating a generic crud service that i want to use throughout my angular application in various feature modules. To achieve this i need to pass a string value to a service in providers: of an ...
ccocker's user avatar
  • 1,236
0 votes
1 answer
3k views

I've created an angular library, say library1, which defines and exposes a service APIService. The APIService has a constructor argument (URL: string), which is injected with an Injection token ...
Sanjay Verma's user avatar
  • 1,676
0 votes
1 answer
1k views

I am trying to assign some value (which I got from http request) from another service to provider token in app.module.ts. My service looks like this: @Injectable() export class AppConfigService { ...
johnek smith's user avatar
1 vote
0 answers
326 views

I'm trying to create a proxy for Angular components. Starting from this solution: https://github.com/Microsoft/TypeScript/issues/4890#issuecomment-141879451 I ended up with this: interface Type<T&...
Manuel's user avatar
  • 11.6k
1 vote
1 answer
3k views

I am new to Angular and am trying to figure out how to inject my Angular service (game service) into another angular service which will be a Resolver (game resolver). Only one instance of my game ...
Ma7erick's user avatar
6 votes
0 answers
2k views

We're well aware that there are various ways of setting config for imported modules. We have '.forRoot()', 'useValue', 'useClass' and such to be used in the importing module. Say for example, we want ...
Alex Pappas's user avatar
  • 2,807
1 vote
0 answers
352 views

I came across some code in which some components have access to their parent component instance but I could not figure out how the "injection" takes place. I expected the code to fit in one of those ...
Stphane's user avatar
  • 3,476
8 votes
2 answers
3k views

I've created two Angular libraries, one has the other as a dependency. the dependency needs to be configured using the forRoot method. how can i pass the configuration data from the parent library to ...
Roip's user avatar
  • 101
1 vote
2 answers
2k views

I have a situation where I want to be able to have multiple widget components used on the page at the same time. I want to isolate the ContainerComponent dependencies so that each ContainerComponent ...
cobolstinks's user avatar
  • 7,201
0 votes
1 answer
375 views

Is there a way to access a field of a service without injecting the service into every component? or equivalently: does some concept of 'global' service exist in Angular 6? My use case is as follows: ...
t_T_t's user avatar
  • 23
2 votes
1 answer
2k views

Abstract class: export abstract class LanguageChangeAware { private sub: Subscription; protected language: string; protected constructor(protected eventService: EventService) { ...
francosang's user avatar
0 votes
2 answers
79 views

i have a following class like this import { Injectable, Inject } from '@angular/core'; @Injectable() export class moviindustry { constructor(private music:musicindustry) { } producer() { ...
Lijin Durairaj's user avatar
2 votes
1 answer
1k views

I am using ngxs in a project and I want to use the ngxs logger plugin, but I want to override the logger itself so that I am able to log to the backend. For this I need to inject my RestService in my ...
António Quadrado's user avatar
2 votes
1 answer
1k views

I have installed ng2-pdf-viewer to show documents within angular 6 app. To make it work I need to import PdfViewerModule in FeatureModule where I want to use <ng2-pdf-viewer> component. The ...
Arseniy  Shelestyuk's user avatar
5 votes
2 answers
4k views

Pretty new to Angular. My app contains 1 service and 3 components. Compiled successfully. I'm getting this error and have no idea what went wrong: Uncaught Error: Can't resolve all parameters for ...
gioravered's user avatar
  • 1,868
2 votes
1 answer
3k views

We're building a cms driven application framework with Angular. We deliver multiple packages that can be used by customers to further customise the ui or logic. Components to that reason will delegate ...
tobi-or-not-tobi's user avatar
1 vote
1 answer
3k views

Simplified version of the code: @Injectable() export class JwtInterceptor implements HttpInterceptor { constructor( private readonly router: Router, private readonly activatedRouteSnapshot: ...
Zazaeil's user avatar
  • 4,135
19 votes
2 answers
9k views

In my angular app (with the angular material) I have a filter panel and I want besides select to be able to make autocomplete (user input value and it sends to the back-end, whereby $regexp query we ...
Alex Bryanskiy's user avatar
6 votes
1 answer
7k views

Just want to make sure I understand the semantics of @Injectable(providedIn: 'root'). Prior to Angular 6 if we import a module from NPM that contains a service we would declare that module in our ...
Ole's user avatar
  • 48.2k
1 vote
2 answers
737 views

I currently have a module setup like below (exerpt); AppModule RoutingModule AuthRouteGuard AuthModule LoginFormComponent AuthService I've defined my AuthService (...
James Crinkley's user avatar
70 votes
3 answers
37k views

I am using a custom Http provider to handle API authentication error. In my CustomHttp, I need to redirect the user to the login page when a 401 status error is emitted by the API. That works fine! ...
Anne Lacan's user avatar

1 2
3