Is it a good practice to convert the observable object to a promise since observable can be used in almost all the occasions instead of promise?
I've started to learn angular recently and come across the below code snippet in a new project(Angular 5) at my workplace. This code snippet is used to load a list of data such as a customer list. This customer list data set is received as a one time action, not as a stream. Therefore it has no technical limitation to use promise. But I would like to know whether there are any drawbacks or limitations.
getViewDataForPage(): Promise<any> {
return this.commonDataService.getViewDataForPage(args_set)
.toPromise()
.catch(error => this._exceptionService.catchBadResponse(error));
}
//in commonDataService.ts
getViewDataForPage(args_set): Observable<any> {
/** logic goes here */
return this.httpConnection.post(viewDataRequest, args);
}