`The NGRX EffectsModule is causing the Http service to be

Working with @ngrx/effects version 4.0.5 alongside Angular version 4.4.4.

An issue arises when incorporating EffectsModule into the app.module.ts file, causing the Http service to become undefined.

Snippet of relevant code:

// app.module.ts
import { BrowserModule, Title } from '@angular/platform-browser';
...
import { HttpModule, Http } from '@angular/http';
...
import { EffectsModule } from '@ngrx/effects';
import { AuthenticationModule } from './authentication/authentication.module';
import { MyEffects } from './myEffects.ts'
...

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
    HttpModule,
    ...
    AuthenticationModule,
    StoreModule.forRoot(reducers),
    EffectsModule.forRoot([MyEffects])
  ]
  ...
})
export class AppModule { }

Note that MyEffects is not associated with the authentication functionality.

Upon attempting to use the sign in feature of my app by calling AuthenticationService.signIn, which internally calls its http instance this.http.post(..., I encountered an error due to this.http being undefined. Further investigation revealed that although this exists, its http property is undefined as well.

If I disable

EffectsModule.forRoot([MyEffects])
, the Http service functions properly and allows successful sign in operations.

Note again that MyEffects does not impact the authentication mechanism.

Answer №1

Updating the @angular/ components from version 4.4.4 to 4.4.5 successfully fixed the issue! 😀

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Create an instance of a class from a group of subclasses, all the while retaining the ability to access static members in Types

I seem to have encountered a dilemma where I am looking to have both the static and abstract keywords used for a member of an abstract class in TypeScript, but it appears that this combination is not supported. The nearest workaround I could come up with ...

Issue with Angular 6 custom pipe causing NaN when utilizing service-sourced data

I am working on a custom pipe that converts a given number into days and hours. The HTML code for this pipe is as follows: <div *ngFor="let unit of units"> <p>Remaining Life</p> <h2>{{ unit.daysRemaining | timeRemaining }}< ...

The process of importing does not produce the anticipated System.register

I'm a beginner with Angular2, currently learning and practicing by doing exercises. I am enrolled in a Udemy course and comparing my exercise progress with the instructions provided. Here is a snippet from my app.component.ts file: import {Component ...

Generics and Overloads in Typescript - Unable to locate specified Generics

My goal is to develop a utility function that enhances the fetch functionality within our application. One of the key aspects I want to incorporate is the ability to accept an optional Transform Function option for altering the data format returned. type T ...

Is it necessary to list all potential strings for accessibilityRole?

When working with accessibilityRole in React Native, I am wondering if there is a way to import all the possible strings instead of typing them out manually. createAccessibilityRole(parent: Element): string { if(isLink) return 'link' return ...

In Angular 5 HTTP GET request, the value "null" is being converted to ""null""

I'm currently in the process of transitioning our application from Angular 4 to Angular 5. In Angular 5, when passing an object model as parameters, if one of the values is null, it gets converted to a "null" string which is causing issues for us. Her ...

It appears that Jest is having trouble comprehending the concept of "import type"

We've just completed a major update to our monorepository, bringing it up to date with the following versions: Nx 14.3.6 Angular 14.0.3 Jest 28.1.1 TypeScript 4.7.4 Although the compilation process went smoothly after the upgrade, we encountered num ...

The 'validate' property within the 'MappingService' class cannot be assigned to the 'validate' property in the base class 'IMappingService' in typescript version 2.8.0

Currently, I am utilizing the AngularJS framework (version 1.5.8) in tandem with the latest TypeScript files (2.8.0). However, upon updating to the newest version of TypeScript, the code below is failing to compile. The IMappingService interface: export ...

The default selection is not showing up on an Angular 8 reactive form

I'm having some trouble with my Angular 8 reactive form that uses Bootstrap 4. Even though I've set the 'selected' attribute for the default option in the select element, it still doesn't display. Each time I have to manually selec ...

SSR routing with parameters in Angular Universal seems to be failing after intial navigation

I'm currently experiencing an issue with routing using path parameters: Navigation works perfectly when moving between categories initially, but once I navigate from one category to another, the routing doesn't update even though the URL in the ...

Building upon the foundation: Extending a base component in Angular

I have a Base Component that is extended by its children in Angular. However, when creating a new Component using angular-cli, it generates html and css files that I do not need for the base component. Is there a way to create a Base Component without inc ...

Tips for updating the class of the body in an Angular 2 and Typescript project

When it comes to managing different classes for the login page versus other pages in an application, there is a need to change the body element's class once the user has logged in. Here is how I am attempting to achieve this: index.html <body [ng ...

The updated release of TypeScript no longer supports the 'window.navigator.msSaveBlob' feature

My TypeScript project (https://github.com/jmaister/excellentexport) is currently functioning well. Recently, after integrating the dependabot process, a suggestion was made to upgrade the TypeScript version: Bump typescript from 4.3.4 to 4.4.3 However, d ...

What causes the form to consistently show as invalid once it has been submitted?

register.html : <form [formGroup]="signupForm" (submit)="onSubmit()" class="form-detail"> <h2>Registration Form</h2> <div class="form-row-total"> <div class="form-row"> <in ...

Error: Unable to locate script.exe when spawning the Nodejs process

When trying to run an exe in my electron app, I am encountering an error. Even though the path is correct, it still throws an error. Uncaught Error: spawn exe/0c8c86d42f4a8d77842972cdde6eb634.exe ENOENT at Process.ChildProcess._handle.onexit (inter ...

The output is displayed on the console, but it cannot be stored in a variable

var x = ""; Promise.all(listOfItems).then(function(results) { for (let j in results) { var newitem = results[j]; x = newitem; console.log(`x: ${x}`); } }); The output on the console displays x: "val ...

Using a Subscription in a Pipe with Angular 13

I am facing a unique challenge that I have been unable to solve despite searching for similar issues on stack overflow. My issue involves translating language in Ionic/Angular and fetching it from a database. Upon loading the application, numerous compone ...

Is it possible to differentiate between a string value and a string enum without needing an additional search?

Within an interface definition, I am utilizing a src member for an icon that can be either a string (representing an image path) or a predefined icon name: interface IIconProperties { src?: string | Codicon; } export enum Codicon { add = "add ...

Failure to render dynamic component as expected

I'm facing an issue with my dynamic component not rendering, even though I can see the markup in the developer tools. Below is the code snippet: var rect = this.svg.selectAll(".button"); var newRects = rect.enter().append("g") .a ...

Attempting to search for an item by its id within a local json file using Angular

I have a local JSON file containing Kitchen types. I created the KitchenTypesService with two functions inside, GET and FIND(ID). The GET function is working fine, but the FIND function is not working and displaying an error "ERROR TypeError: Unable to lif ...