Skip to content

Daniele Ghidoli

Angular Tips & Tricks

  • About me
  • My Nomad Life

Tag: Observable

When should I unsubscribe from an Observable in Angular?
Posted on October 30, 2020October 30, 2020

When should I unsubscribe from an Observable in Angular?

You have probably heard many times that it’s a good practice to unsubscribe from an Observable after you subscribe to it in your Angular application. But is it always the case? Do you really need to do it?

Angular: How to prevent duplicated HTTP requests
Posted on October 28, 2020October 28, 2020

Angular: How to prevent duplicated HTTP requests

What happens if two different components call the same service which makes an HTTP call to an API? You will have two duplicated calls! Is it possible to share the first response with all subscribers to prevent duplicate HTTP requests? Yes, it is! Let’s see how.

Testing an Angular Component with Mock Services
Posted on November 6, 2016October 27, 2020

Testing an Angular Component with Mock Services

When testing a component with service dependencies, the best practice is mocking them, in order to test the component in an isolated environment. In fact, our purpose is testing the component, not the services, that can be trouble, especially if they try to interact with a server.In this article we will see the two methods … Continue reading Testing an Angular Component with Mock Services

Combining multiple Http streams with RxJS Observables in Angular
Posted on October 22, 2016October 27, 2020

Combining multiple Http streams with RxJS Observables in Angular

RxJS Observables, compared to the old Promises in Angular 1, seem to be more complicated to understand, but they are far more flexible. Let’s see how we can combine and chain them, in order to merge multiple Http streams of data and get what we need.

Menu

  • About me
  • My Nomad Life
  • Twitter
  • Github
  • Facebook
  • Instagram
  • Linkedin
  • Medium

Search a post

Categories

  • Bugs
  • i18n
  • RxJS
  • Testing

Most viewed

  • Why my Angular service doesn't return the assigned value?
  • How to load an Angular app just after the user is logged
  • Angular: How to prevent duplicated HTTP requests
  • Testing an Angular Component with Mock Services
  • When should I unsubscribe from an Observable in Angular?

Follow me on Twitter

My Tweets
© Daniele Ghidoli