19 lines
522 B
TypeScript
19 lines
522 B
TypeScript
import { HttpClient } from "@angular/common/http";
|
|
import { inject, Injectable } from "@angular/core";
|
|
|
|
@Injectable({
|
|
providedIn: 'root'
|
|
})
|
|
export class CandidateDataService {
|
|
httpClient = inject(HttpClient)
|
|
|
|
response: any | null = null;
|
|
error: any | null = null;
|
|
|
|
sendRequest() {
|
|
this.httpClient.get('http://localhost:3000/app/candidates').subscribe({
|
|
next: (res) => this.response = JSON.stringify(res),
|
|
error: err => this.error = JSON.stringify(err)
|
|
})
|
|
}
|
|
} |