25 lines
613 B
TypeScript
25 lines
613 B
TypeScript
|
import { Injectable } from '@angular/core';
|
||
|
import { HttpClient } from '@angular/common/http';
|
||
|
|
||
|
@Injectable({
|
||
|
providedIn: 'root'
|
||
|
})
|
||
|
export class ApiService {
|
||
|
|
||
|
constructor(
|
||
|
public http: HttpClient
|
||
|
) { }
|
||
|
|
||
|
addCountry(data) {
|
||
|
// return this.http.post('./insert.php', data);
|
||
|
return this.http.post('http://localhost/backend/insert.php', data);
|
||
|
}
|
||
|
getCountries() {
|
||
|
return this.http.get('http://localhost/backend/read.php');
|
||
|
}
|
||
|
delCountry(countryId) {
|
||
|
// return this.http.post('./insert.php', data);
|
||
|
return this.http.post('http://localhost/backend/delete.php', countryId);
|
||
|
}
|
||
|
|
||
|
}
|