I am experienced java developer and recently working on angular as well, most of the time i use observable<any> as a return type of my http api method or db read method but what is the best way to do this to avoid [object, object] read error or object is undefined.
I would appreciate your help. thanks
getComments(): Observable<any> {
return this.http.get(environment.api + '/payments/6');
}
addComments(body): Observable<any> {
console.log(body);
return this.http.post(environment.api + '/payments/account', body);
} ```
[object, object] read errororobject is undefinedare due to some bug in your code. Totally unrelated to your question ("what is the best way to do X"). Bugs can creep into the best designs; even to most experienced developers