Receiving content through http get

Last Updated on

This example will get a typed array of http result through get:

    this.http.get<ILogic10BaseCategory[]>(this.baseCatsForIngsUrl).subscribe(data => {
      console.log("-- successfully got: " + data)
    });

This example will get any http result:

    this.http.get<any[]>(this.catsUrl).subscribe(data=> {
      this.arrCats = data;
      console.log("-arrCats[0]: " + this.arrCats[0]);
    });

More examples can be found at https://jasonwatmore.com/post/2019/09/06/angular-http-get-request-examples

Lämna ett svar