Hi Dev,

In this tutorial, i will show you simple example of httpclient request with angular 10 app. you can easily send http request in angular 10 application. we will create httpclient service to getting data using HttpClientModule and HttpClient in angular 10.

Every App must important to sending api request to another server. we can use http client request and get data and store data information to our server. as specially when you are working with angular, vue, react application. you must have to learn how to run http client request with angular 10.

Here, i will give you very simple example to get all data using api and store data using api. we will use jsonplaceholder api for testing now. so we don’t require to create new api for it.

So, let’s see bellow example step by step how to create http service and how to use it.

Step 1: Create New App

You can easily create your angular app using bellow command:

ng new my-new-app

Step 2: Import HttpClientModule

In this step, we need to import HttpClientModule to app.module.ts file. so let’s import it as like bellow:

src/app/app.module.ts

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';

import { AppComponent } from './app.component';
import { HttpClientModule } from '@angular/common/http';

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
    HttpClientModule
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }

#angular #javascript #web-development

Angular 10 HttpClient Service Tutorial and Example
2.05 GEEK