Java, .NET, PHP, PYTHON, ANGULAR, .NET, ML, Data Scince, Testing, CI Tutorials in Easy Languages.

"Best Software Training, Internship, Project Development center of Indore India, Helpline 780506-3968"

1.1) First BackEnd Developer Create Web Services using PHP,.NET, JAVA , PYTHON, RUBY or CI.

      BackEnd Developers will provide Web URL, Input Parameters and Output Parameter and Method (GET, POST)

for example http://shivaconceptsolution.com/webservices/tr.php

Input Parameters:-  tno,tdet

Post Method


You can use postman or other web services checking tools

for postman open chrome and write chrome://apps in url , download plugin, and check URL after successful login.



1.2 create component then create a path


1.3 write the following code to call web service under component typescript

import { Component, OnInit } from '@angular/core';
import { HttpClient,HttpHeaders } from '@angular/common/http';
const httpOptions = {
  headers: new HttpHeaders({
    'Content-Type':  'application/json'
  })
};
@Component({
  selector: 'app-truck',
  templateUrl: './truck.component.html',
  styleUrls: ['./truck.component.css']
})

export class TruckComponent implements OnInit {
  data:string='';
  tid:string='';
  tdesc:string='';
   constructor(private http: HttpClient) { }

  ngOnInit() {
  this.addTruck ();
  }

  addTruck () {

   let t = {'tno':'Mytruck','tdet':'nilesj'};
  this.http.post("https://shivaconceptsolution.com/webservices/tr.php",t,httpOptions).subscribe((res)=>{
            console.log(res);
         
        });
        alert('data inserted');
}
}




Post a Comment

If you have any doubt in programming or join online classes then you can contact us by comment .

Previous Post Next Post