“http dapatkan di angularjs” Kode Jawaban

HTTP Angular

	constructor(private http: HttpClient) { }

	//GET ALL
	GetAll(): Observable<any> {
		return this.http.get(this.baseUrl + "/all");
	}
    
    //GET SINGLE
    GetSingle(id: any): Observable<any> {
		return this.http.get(this.baseUrl + "/single/" + id);
	}
    
    //PUT
    Update(obj: Object) {
		const data = JSON.stringify(obj);
		return this.http.put(this.baseUrl, data, {
			headers: new HttpHeaders({
				"Content-Type": "application/json",
			}),
		});
	}

    //POST
	Create(obj: Object) {
		const data = JSON.stringify(obj);
		return this.http.post(this.baseUrl, data, {
			headers: new HttpHeaders({
				"Content-Type": "application/json",
			}),
		});
	}
    //DELETE
	Delete(obj: Object) {
		const data = JSON.stringify(obj);
		return this.http.delete(this.baseUrl + "/delete", data, {
			headers: new HttpHeaders({
				"Content-Type": "application/json",
			}),
		});
	}
Lucky Lark

http dapatkan di angularjs

var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope, $http) {
  $http.get("welcome.htm")
  .then(function(response) {
    $scope.myWelcome = response.data;
  });
});
Harendra

Jawaban yang mirip dengan “http dapatkan di angularjs”

Pertanyaan yang mirip dengan “http dapatkan di angularjs”

Lebih banyak jawaban terkait untuk “http dapatkan di angularjs” di JavaScript

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya