Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR TYPESCRIPT

api service in angular

import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { GET_ALL_PROJECT_ROUTE } from 'src/constants';

@Injectable({
  providedIn: 'root',
})
export class ApiService {
  constructor(private http: HttpClient) {}

  getProjects() {
    return this.http.get(GET_ALL_PROJECT_ROUTE);
  }
}
 
PREVIOUS NEXT
Tagged: #api #service #angular
ADD COMMENT
Topic
Name
9+4 =