I am currently delving into the world of Angular and Typescript to interact with APIs. While I have some experience working with APIs in Javascript, I am relatively new to this setup. The issue I am facing revolves around the code snippet below:
To tackle this challenge, I crafted a fresh service file:
growth-service.ts
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
@Injectable({
providedIn: 'root'
})
export class GrowthService {
url = 'https://uks-tst-tbp-gw.azurewebsites.net/business/getcategories'
constructor(private http:HttpClient) { }
getAllOptions(): any{
return this.getAllOptions.get(this.url)
}
}
The part that reads
return this.getAllOptions.get(this.url)
is triggering an error specifically on .get
, displaying:
TS2339: Property 'get' does not exist on type
I've been scratching my head trying to figure out why this error keeps surfacing. Any insights would be greatly appreciated.