Skip to main content

Posts

Showing posts with the label cowin api in angular

How to call API in angular & with an example of PHP API

How to call API in angular & with an example of PHP API . Software required:- Node ->  https://nodejs.org/en/download/ VS Code ->  https://code.visualstudio.com/download Angular CLI -> npm install - g @angular / cli To understand how to call API in angular follow the below steps:- Step:1 Project Setup 1. Create a project in angular ->  ng new project name 2. Install npm -> npm i 3. Import HttpClientModule in app.module.ts -> import { HttpClientModule } from '@angular/common/http' ; 4. Add provider providers : [ WebserviceService ], example -> ng new crudInAngularPHP Step:2 API Service 1. Create a service with name webservice -> ng g s services/webservice 2. import modules import { HttpClient, HttpHeaders, HttpRequest, HttpEvent } from '@angular/common/http'; 3 .    C all constructor  constructor( private http: HttpClient) 4. Add a common function to get a response of API with name postRequest:-      ...