Is it necessary to unsubscribe from observables created by Http methods?

Do you need to unsubscribe from Angular 2 http calls to prevent memory leak? fetchFilm(index) { var sub = this._http.get(`http://example.com`) .map(result => result.json()) ...

Angular 2 - View not updating after model changes

I have a simple component which calls a REST api every few seconds and receives back some JSON data. I can see from my log statements and the network traffic that the JSON data being returned is...

Difference between .unsubscribe to .take(1)

I wonder, if there is any difference in performance between using .take(1) and .unsubscribe when unsubscribe is used right after the subscription: var observable =...

Angular2 how to update an item inside an observable collection

Update, in short: I am looking for the equivalent of doing something like this but for an Observable rather than a regular array: var i = this.customers.findIndex(customer => customer._id ===...

angular2 ngFor not working while fetching data from api on ngOnInit()

comment.component.ts: import { Component, OnInit } from '@angular/core'; import { Router} from '@angular/router' import { Comment } from 'comment entity path' import {CommentService} from 'comment...

RxJS: Is there an no-op observable?

I have an action that will then trigger an ajax request. If the action fails for some reason, I want to do nothing. Instead of creating a blank action that just returns the previous state, is...

NPM install hangs when installing packages

I currently using a project. It works fine but the problem when I remove the project files(except node_modules) to another folder or GitHub, reinstalling packages via npm is not successful. It...

Angular No module factory available for dependency type: ContextElementDependency

Running ng build on my Angular 4 project give this error : 14% building modules 40/46 modules 6 active ...es\@angular\http\@angular\http.es5.js An error occured during the build: Error: No...

How to propagate errors through catchError() properly?

I wrote a function that is pipe-able: HandleHttpBasicError<T>() { return ((source:Observable<T>) => { return source.pipe( catchError((err:any) => { let msg = ''; if(err && err...

Modules not found when using express

I want to expose REST service in electron app and I want to use expressJS with electron, as tutorial states I added express and @types/express. I tried to expose a "get " but when I build and run...

TypeError: Cannot add property 1, object is not extensible↵ at Array.push (<anonymous>)

I am trying to add some data to an array but I am getting not extensible error. Component code: this._store.select(p => p.collection.workspaceCollectionPages).subscribe((data:...

Duplicate Http requests using service Angular 6

I am trying to remove an object from my database in an .Net Core 2.1 + Angular Application. Every time I make my call however two records are created. While debugging it appears that the call is...

Add selected items to ng-select with multiple and typeahead

I'm using ng-select to select multiple values from a large list that is remotely loaded depending on what the user types in the box. Here are my requirements: Tags added dynamically Dropdown is...

How to make a sequence of http requests in Angular 6 using RxJS

I've been looking for a solution all over the web, but couldn't find anything that fits my user case. I'm using the MEAN stack (Angular 6) and I have a registration form. I'm looking for a way to...

rxjs6 - TypeError: Cannot read property 'pipe' of undefined

After migrating from RxJs 5 beta version to RxJs 6 getting below error - ERROR TypeError: Cannot read property 'pipe' of undefined at Object.get [as selectedTimecard] This is my latest code...

ERROR in : The pipe 'translate' could not be found

I am using Angular 7.1 but unfortunately I am not able to make the translate pipe of ngx-translate to work… package.json "dependencies": { "@angular/animations": "~7.1.0", ...

Module not found: Error: Can't resolve 'crypto'

I am getting the following list of errors when I run ng serve. My package JSON is as follows: { "name": "ProName", "version": "0.0.0", "scripts": { "ng": "ng", "start": "ng serve", ...

Angular CLI create component throw error; Could not find an NgModule

I am working on Angular 6 application and trying to use CLI to create new component using 'ng g c myComponent' but getting error My all components are under module folder of app / (root level...

switchMap after catchError does not emit values

I'm using Angular and RxJS. I intend to add an item to a collection (1st Observable), and then get the collection (2nd Observable), everything on the same stream of data. Then I offer the...

Ng serve throwing @angular/core/core has no exported member 'eeFactoryDef'

Im getting like 50 errors that all say that angular/core/core has no exported member 'eeFactoryDef'. They come from different node_modules, for example angular/cdk, ng-bootstrap, ngx-pipes,...

Uncaught TypeError: Cannot read property 'id' of undefined at registerNgModuleType - angular PWA

after adding @angular/pwa to my app ng add @angular/pwa --project appName I get error core.js:34469 Uncaught TypeError: Cannot read property 'id' of undefined at registerNgModuleType If I in...

Is there an HTTP Connection Timeout in client-side JS/Angular?

I'm using Angular's HttpClient to make HTTP requests and I'd like to specify a timeout for them. I know I can use HTTPInterceptors and add a timeout to RxJS operators, however, these apply to the...

Dependency Injection for Nest JS Interceptor is Undefined

I have created an interceptor as shown below that I wish to use globally. I added the interceptor to my module and set it up so that nest js should handle the DI for me per NestJS Docs, however...

Why am I getting No Provider for a Service in Angular when i have specified the service as a provider in the Feature Module

I have a problem where my application giving an error: No Provider for Data Service. This typically happens when you have forgotten to list your service as a provider either in the app module or...

Is there a .get() in angular firestore?

I have seen there is a .valueChanges() and .snapshotChanges() which both listen to changes in the database but what if I want to retrieve the data just once? I noticed that adding .pipe(take(1))...

Angular 'Cannot find a differ supporting object '[object Object]' of type 'object'. NgFor only supports binding to Iterables such as Arrays.'

I'm creating an Angular app which shows list of projects and list of users from postgresql database, but I'm having issues with showing list of users in html. The problem is that Angular is...

"inject() must be called from an injection context" when importing angular app using module federation architecture

I am trying to implement the micro-frontend concept in angular using webpack5 module federation by following this example Module federation with angular, but i am facing this error I tried the...

RxJS finalize(): pass the last emitted value to the callback

In my Angular service, I've got a loading prop which I set true as a first thing done in the method fetching data. I want to set loading to false after the data is downloaded. I was doing it in...

npm install failing with "git dep preparation failed"

I am new to node and npm and am trying to setup my system with node and npm so that I can run a local project. After installing the latest version of node and npm, when I run the command npm...

Angular 8 ERROR Error: Unable to find context associated with [object HTMLDivElement]

Just another day in the office, right? What once worked is no longer working. Yay! I am supporting an Angular 8 web application and attempting to kickstart localhost:4200. That said, the following...