My backend server does not notify the client with any new data. so it's only based on traditional request/response.
Can i turn all my services to use promises instead of observable and subscribers?
for example, i want my service to look like:
import { Injectable } from '@angular/core'; import { HttpClient } from '@angular/common/http'; @Injectable({ providedIn: 'root', }) export class HeroService { restEndpoint: string; constructor(private http: HttpClient) { this.restEndpoint = 'entity' } get(id?: number): Promise<Entity> { return this.http.get<Entity>(environment.apiEndpoint + restEndpoint); } post(entity: Entity): Promise<Entity> { return this.http.post<Entity>(environment.apiEndpoint + restEndpoint); } put(id: number, entity: Entity): Promise<Entity> { return this.http.post<Entity>(environment.apiEndpoint + restEndpoint); } delete(id: number): Promise<any> { return this.http.delete<any>(environment.apiEndpoint + restEndpoint); } } ( functions returns promises)