Within my api-service.ts, I have an array that holds some data.
public getData():Observable<any[]> {
return Observable.toString[ObsResult];
}
Now, in the main component, I am attempting to call the getData() method to render the data in
main.component.html
service.getData().subscribe({result => console.log (result)});
However, I encounter the error message:
TypeError: Cannot read property 'subscribe' of undefined
I suspect the issue lies within this line, but I am unsure about what should be placed here:
Observable.toString