I am trying to convert an observable array in an array and return the new array with the spread operator in the get function.
I tried to convert the observable array manually before subscribing via map operator but there is no solution in sight (it remains an observable of type void)
How do I convert that observable in an array to use the spread operator in get orders()where I return an array type?
I need it for a calculation...
//in grid.service.ts
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Order } from '../order/order.model';
@Injectable({
    providedIn: 'root'
})
export class OrderGridService{
constructor(private http: HttpClient){}
private _orders: Order[];
getAllOrder(): Observable<Order[]> {
  return this.http.get<Order[]>(this._orderURL + "/" + 
   this.userID + "/" + this.currentUservalueToken);
 };
    get orders(): Order[] {
        return [...this._orders];
    }
}
I need to assign to the variable _orders the response of the html request I do in the function getAllOrder() but there it returns an Observable of Order[] instead of an array so I can just return [...this._orders]
I hope you understand what I am trying to say..
Thank you for any advice!
 
    