I have a service with this code:
cars() {
return 'something here';
}
Then from the component I want to get the data with an observable so I'm doing this:
getcars() {
this.dataService.cars().subscribe((result) => {
console.log(result);
});
}
I cannot do this as I'm getting:
Error: Property 'subscribe' does not exist on type 'string'.
How can I fix this?