Currently, I have a code for my service like this:
cars() {
return 'something here';
}
Next, in order to retrieve the data using an observable from the component, I am attempting the following:
getcars() {
this.dataService.cars().subscribe((result) => {
console.log(result);
});
}
Unfortunately, when trying to execute this, I'm encountering the following error message:
Error: Property 'subscribe' does not exist on type 'string'.
How would you suggest resolving this issue?