RXJS Get call

    1

    5

    HARIGOVIND VALSAKUMAR

    AngularRXJSObservable
    HGV Public Cookbook

    Recipe for calling Get API endpoint

    import { HttpHeaders, HttpClient } from '@angular/common/http';
    import { Observable } from 'rxjs';
    import { map, tap } from 'rxjs/operators';
    
    constructor(private http: HttpClient) {}
      GetAllSaved(): Observable<Array[]> {
        return this.http
          .get<Array<string>>('Your API URL')
          .pipe(
            map((response) => {
              const jsonResult = JSON.parse(JSON.stringify(response));
              return jsonResult;
            })
          );
      }
    
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Playground
    • Snippets
    • Cookbooks
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.