Dylan  Iqbal

Dylan Iqbal


RxJS tutorial - Multiple HTTP requests in Angular 8 with forkJoin

A comprehensive step by step tutorial on Multiple HTTP using Angular 8 RxJS forkJoin operator including an example

One of the RxJS operators is the forkJoin which handles a group of Observable by detecting the final emitted value of each. So, we are using this RxJS operator for multiple HTTP requests or RESTful API request of the Angular 8 Web Application.

The main purpose is to use one Loading spinner process for multiple RESTful API requests of the Angular 8 Web Application. We will put the multiple HTTP or RESTful API request in the Angular 8 Service. So, the Loading spinner will load and stop from the Angular 8 Controller and displayed in the Angular 8 Template.

We will display the weathers of the 4 cities at one time on one page. We use the Meta weather free API for it. You can see each API endpoint at the steps of this tutorial.

The following tools, framework, libraries, and modules are required for this tutorial:

Before moving to the steps, make sure you have installed the latest Node.js. To check it, type this command in the terminal or Node.js command line.

node -v 
npm -v 

Install Angular CLI and Create Angular 8 Application

We will create an Angular 8 application using Angular CLI from the terminal or command line. For that, we have to install a new Angular CLI or update an existing Angular CLI using this command from the terminal or command line.

sudo npm install -g @angular/cli

You can skip sudo if you are using Command-Line or if your terminal allowed without sudo. To check the existing version of Angular CLI, type this command.

ng version


   / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|

  / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |

 / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |

/_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|



Angular CLI: 8.1.2

Node: 10.15.1

OS: darwin x64




Package                      Version


@angular-devkit/architect    0.801.2

@angular-devkit/core         8.1.2

@angular-devkit/schematics   8.1.2

@schematics/angular          8.1.2

@schematics/update           0.801.2

rxjs                         6.4.0

We are using above Angular 8 and RxJS version. Next, we have to create a new Angular 8 application using this command.

ng new angular-forkjoin

Answer the question the same as below.

? Would you like to add Angular routing? No
? Which stylesheet format would you like to use? SCSS   [ https://sass-lang.com/documentation/synta

Next, go to the newly created Angular 8 application folder then run the Angular 8 application for the first time.

cd ./angular-forkjoin 
ng serve

Now, open the browser then go to [http://localhost;4200/](http://localhost;4200/ "http://localhost;4200/") and you will see the standard Angular 8 page.

Create an Angular 8 Service

The main feature that we mention in the title of this tutorial is using the RxJS forkJoin to call multiple RESTful API at one call. We do that in the Angular 8 Service. For that, generate a new Angular 8 service using Angular CLI.

ng g service rest-api

Next, open and edit src/app/rest-api.service.ts then add these imports.

import { Observable, of, throwError } from 'rxjs'; 
import { HttpClient, HttpHeaders, HttpErrorResponse } from '@angular/common/http'; 
import { forkJoin } from 'rxjs';

Add this line after the imports lines as a constant variable of the RESTful API endpoint that we will use.

const apiUrl = 'http://localhost:1337/www.metaweather.com/api/location/';

As you see, we are using the localhost:1337 in the front of the Meta weather URL because the RESTful API, not CORS enabled. For that, we have to install the Corsproxy-HTTPS using this command.

sudo npm install -g corsproxy-https

Next, inject HttpClient module to the constructor.

constructor(private http: HttpClient) { }

Next, create multiple RESTful API calls at once in a function using the above API URL with a different parameter value that describe the code of the city.

getData(): Observable<any> {
  const response1 = this.http.get(apiUrl + '44418/');
  const response2 = this.http.get(apiUrl + '2459115/');
  const response3 = this.http.get(apiUrl + '28743736/');
  const response4 = this.http.get(apiUrl + '1940345/');
  return forkJoin([response1, response2, response3, response4]);

As you see the forkJoin combine the 4 API calls together at the end of the function. The Angular 8 HttpClient module should register in the Angular 8 main module. For that, open and edit src/app/app.module.ts then add this import.

import { HttpClientModule } from '@angular/common/http';

Then add this module to the @NgModule imports.

 imports: [

Display Multiple Details of Data using Angular 8 Material

Now, we have to display the 4 different API calls responses to the Angular 8 page using Angular 8 Material. First, we have to add Angular 8 Material using this Angular CLI.

ng add @angular/material

Answer all question that shows during the installation as below.

? Choose a prebuilt theme name, or "custom" for a custom theme: Indigo/Pink        [ Preview: https
://material.angular.io?theme=indigo-pink ]
? Set up HammerJS for gesture recognition? Yes
? Set up browser animations for Angular Material? Yes

We will register all required Angular 8 Material components or modules to src/app/app.module.ts. Open and edit that file then add these imports.

 import {
  MatFormFieldModule } from '@angular/material';

Register that imported modules to the @NgModule imports.

 imports: [

Next, open and edit src/app/app.component.ts then add this import.

import { RestApiService } from './rest-api.service';

Add these lines of variables after the title variable.

data1: any = {}; 
data2: any = {}; 
data3: any = {}; 
data4: any = {}; 
isLoadingResults = true;

Add the constructor that inject the REST API service and call the get data function.

constructor(private api: RestApiService) {

Add a function to get data from the REST API service.

getData() {
    .subscribe(res => {
      this.data1 = res[0];
      this.data2 = res[1];
      this.data3 = res[2];
      this.data4 = res[3];
      this.isLoadingResults = false;
    }, err => {
      this.isLoadingResults = false;

Next, open and edit src/app/app.component.html then replace all exisiting HTML tags with these tags.

 <div class="example-container mat-elevation-z8">
  <div class="example-loading-shade"
    <mat-spinner *ngIf="isLoadingResults"></mat-spinner>
  <mat-card class="example-card">
      <mat-card-subtitle>Sunrise at {{data1.sun_rise | date: 'HH:mm:ss'}}, Sunset at {{data1.sun_set | date: 'HH:mm:ss'}}</mat-card-subtitle>
        <li *ngFor="let source of data1.sources"><a href="{{source.url}}" target="_blank">{{source.title}}</a></li>
  <mat-card class="example-card">
      <mat-card-subtitle>Sunrise at {{data2.sun_rise | date: 'HH:mm:ss'}}, Sunset at {{data2.sun_set | date: 'HH:mm:ss'}}</mat-card-subtitle>
        <li *ngFor="let source of data2.sources"><a href="{{source.url}}" target="_blank">{{source.title}}</a></li>
  <mat-card class="example-card">
      <mat-card-subtitle>Sunrise at {{data3.sun_rise | date: 'HH:mm:ss'}}, Sunset at {{data3.sun_set | date: 'HH:mm:ss'}}</mat-card-subtitle>
        <li *ngFor="let source of data3.sources"><a href="{{source.url}}" target="_blank">{{source.title}}</a></li>
  <mat-card class="example-card">
        <mat-card-subtitle>Sunrise at {{data4.sun_rise | date: 'HH:mm:ss'}}, Sunset at {{data4.sun_set | date: 'HH:mm:ss'}}</mat-card-subtitle>
          <li *ngFor="let source of data4.sources"><a href="{{source.url}}" target="_blank">{{source.title}}</a></li>

Finally, open and edit src/app/app.component.scss then add these lines of SCSS codes to give an adjustment for the styles.

 .example-container {
  position: relative;
  padding: 5px;
  background-color: aqua;
.example-loading-shade {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 56px;
  right: 0;
  background: rgba(0, 0, 0, 0.15);
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
.example-card {
  margin: 5px;
  padding-bottom: 40px;

Run and Test the Complete Angular 8 RxJS Example

As you see in the previous steps, we already installing Corsproxy-HTTPS Node module. So, open the new Terminal/Command Line tab then run that Corsproxy before running the Angular 8 Application.


Back to the current Terminal tab, type this command to run the Angular 8 application.

ng serve

In the browser go to [http://localhost:4200/](http://localhost:4200/ "http://localhost:4200/") then you will see the single page like below.

That it’s, the Angular 8 RxJS Multiple HTTP Request using the forkJoin Example. You can find the full source code from our GitHub.

#angular #web-development #node-js

What is GEEK

Buddha Community

RxJS tutorial - Multiple HTTP requests in Angular 8 with forkJoin

I am Developer


Laravel 8 Tutorial for Beginners

Hello everyone! I just updated this tutorial for Laravel 8. In this tutorial, we’ll go through the basics of the Laravel framework by building a simple blogging system. Note that this tutorial is only for beginners who are interested in web development but don’t know where to start. Check it out if you are interested: Laravel Tutorial For Beginners

Laravel is a very powerful framework that follows the MVC structure. It is designed for web developers who need a simple, elegant yet powerful toolkit to build a fully-featured website.

Recommended:-Laravel Try Catch

#laravel 8 tutorial #laravel 8 tutorial crud #laravel 8 tutorial point #laravel 8 auth tutorial #laravel 8 project example #laravel 8 tutorial for beginners

Christa  Stehr

Christa Stehr


Install Angular - Angular Environment Setup Process

Angular is a TypeScript based framework that works in synchronization with HTML, CSS, and JavaScript. To work with angular, domain knowledge of these 3 is required.

  1. Installing Node.js and npm
  2. Installing Angular CLI
  3. Creating workspace
  4. Deploying your First App

In this article, you will get to know about the Angular Environment setup process. After reading this article, you will be able to install, setup, create, and launch your own application in Angular. So let’s start!!!

Angular environment setup

Install Angular in Easy Steps

For Installing Angular on your Machine, there are 2 prerequisites:

  • Node.js
  • npm Package Manager

First you need to have Node.js installed as Angular require current, active LTS or maintenance LTS version of Node.js

Download and Install Node.js version suitable for your machine’s operating system.

Npm Package Manager

Angular, Angular CLI and Angular applications are dependent on npm packages. By installing Node.js, you have automatically installed the npm Package manager which will be the base for installing angular in your system. To check the presence of npm client and Angular version check of npm client, run this command:

  1. npm -v

Installing Angular CLI

  • Open Terminal/Command Prompt
  • To install Angular CLI, run the below command:
  1. npm install -g @angular/cli

installing angular CLI

· After executing the command, Angular CLI will get installed within some time. You can check it using the following command

  1. ng --version

Workspace Creation

Now as your Angular CLI is installed, you need to create a workspace to work upon your application. Methods for it are:

  • Using CLI
  • Using Visual Studio Code
1. Using CLI

To create a workspace:

  • Navigate to the desired directory where you want to create your workspace using cd command in the Terminal/Command prompt
  • Then in the directory write this command on your terminal and provide the name of the app which you want to create. In my case I have mentioned DataFlair:
  1. Ng new YourAppName

create angular workspace

  • After running this command, it will prompt you to select from various options about the CSS and other functionalities.

angular CSS options

  • To leave everything to default, simply press the Enter or the Return key.

angular setup

#angular tutorials #angular cli install #angular environment setup #angular version check #download angular #install angular #install angular cli

Clara  Gutmann

Clara Gutmann


Angular 8 CRUD Example | Angular 8 Tutorial For Beginners

Angular 8 CRUD is a basic operation to learn Angular from scratch. We will learn how to build a small web application that inserts, read data, update and delete data from the database. You will learn how to create a MEAN Stack web application. In this Angular 8 Tutorial Example, you will learn a new framework by building a crud application.

New features of Angular 8

You check out the new features in brief on my  Angular 8 New Features post.

I have designed this Angular 8 CRUD Tutorial, especially for newcomers, and it will help you to up and running with the latest version of Angular, which is right now 8.

#angular #angular 8 #angular 8 crud

I am Developer


Laravel 8 Tutorial For Beginners

In this tutorial, i will provide you some useful tutorial of laravel 8 version. So, you can learn laravel 8 an easy way.

Recommended:- Laravel Eloquent whereRaw Query Example
Recommended:- How to Get Random Records in Laravel
Recommended:- Laravel InsertOrIgnore Example
Recommended:- Laravel whereIn, whereNotIn With SubQuery Example
Recommended:- Laravel Where Null and Where Not Null Query
Recommended:- Laravel Group by Example
Recommended:- Laravel Order by Example
Recommended:- Laravel 8 Joins Example Tutorial
Recommended:- Laravel 8 – Form Validation Example
Recommended:- Laravel 8 Ajax Post Form Data With Validation
Recommended:- Laravel 8 Flash Message Example Tutorial
Recommended:- Laravel 8 Auth Scaffolding using Jetstream
Recommended:- Laravel 8 Autocomplete Search from Database Tutorial
Recommended:- How to Create Controller, Model in Laravel 8 using cmd
Recommended:- How to Use Helper Function in Laravel 8
Recommended:- Laravel 8 Send Mail using Queue Tutorial
Recommended:- Laravel 8 Google Recaptcha V3 Example
Recommended:- Laravel 8 QR Code Generator Tutorial Example
Recommended:- Laravel 8 Image Upload Tutorial
Recommended:- Laravel 8 Ajax Image Upload with Preview Tutorial
Recommended:- Laravel 8 Ajax Multiple Image Upload Tutorial
Recommended:- Laravel 8 FullCalendar Ajax Tutorial Example
Recommended:- Laravel 8 Livewire File Upload Tutorial Example
Recommended:- Laravel 8 Login with Linkedin Example Tutorial
Recommended:- Laravel 8 Multi Auth (Authentication) Tutorial
Recommended:- Laravel 8 Rest API with Passport Tutorial
Recommended:- Laravel 8 JWT Rest API Authentication Example Tutorial
Recommended:- Laravel 8 Datatables with Relationship Tutorial Example
Recommended:- Laravel 8 Joins Example Tutorial
Recommended:- Laravel 8 Summernote Image Upload Tutorial Example
Recommended:- Laravel 8 Crop Image Before Upload using Cropper JS
Recommended:- Laravel 8 – Dynamically Multiple Add or Remove Input Fields using jQuery
Recommended:- Laravel 8 PHP Guzzle Http Client GET & POST Example
Recommended:- Laravel 8 Livewire Datatables Tutorial Example
Recommended:- Laravel 8 Google Chart Tutorial Example
Recommended:- Laravel 8 Generate Fake Data
Recommended:- Laravel 8 Livewire Load More OnScroll Tutorial Example
Recommended:- Laravel 8 Dynamic Dependent Dropdown using Ajax
Recommended:- Laravel 8 Auto Load More Data On Page Scroll
Recommended:- Laravel 8 Simple CRUD Example Tutorial
Recommended:- Laravel 8 Rest API CRUD with Passport Auth Tutorial
Recommended:- Laravel 8 DataTable CRUD Tutorial
Recommended:- Laravel 8 Ajax CRUD Using Datatable Tutorial
Recommended:- Laravel 8 Ajax CRUD with Image Upload Tutorial
Recommended:- Laravel 8 Livewire CRUD with Jetstream Tutorial

#laravel 8 tutorial for beginners #laravel 8 tutorial for beginners step by step #laravel 8 tutorial #laravel 8 authentication tutorial

Sasha  Roberts

Sasha Roberts


Angular Rxjs: Use .map() And Async Pipe (Refactor Your Code)

In this video, we will see how to improve our code using the #rxs map operator and #angular #async pipe.

The components should be clean and minimal and should not have code that manipulates the data. Responsible for data manipulation is a service.
The goal is to prepare our data and return an #observable pipe so that we can use an #async pipe in the template.

code: https://github.com/profanis/codeShotsWithProfanis/tree/13/rxjsMapAndAsyncPipe

#angular #rxjs #observable #map #async

#angular rxjs #angular #angular tutorial #what is angular