I have build an Angular service which is responsible to retrieve datas from a REST endpoint. It works but I need to know if
- There is other ways to do it ?
- And even more importantly. If there is, which way is the proper one ?
Thank you for your help.
Here is my code:
@Injectable()
export class XXXService {
  private static ENDPOINT = "./api/XXX/YYY/rate";
  constructor(private http: HttpClient) {
  }
  public getRateDatas(): Observable<IRate[]> {
    const httpParams = new HttpParams()
      .set('paramId', 's1')
      .set('paramCode', 'r1')
      .set('paramNumber', '2');
    return this.http.get<IRate[]>(XXXService.ENDPOINT, {params: httpParams});
  }
}
 
    