i´m using angular version 11 I'm accessing a function of a service to get all the data from an API and show it in a table I created using the control ng generate @angular/material:table
Client Model
export interface Client {
    id?: number,
    Codigo: string,
    Nome: string,
    Contribuinte?: number,
    Morada1?: string,
    Morada2?: string,
    Localidade?: string,
    CodigoPostal?: string,
    LocalidadeCP?: string,
    Contacto?: number,
    Telefone: number,
    EMail: string,
    Observacoes?: string
}
Client Service
read(): Observable<Client[]>{
    return this.http.get<Client[]>(this.baseUrl).pipe(
      catchError(e => this.handelError(e))
      )
  }
Client table
clients: Client[] = []               
  
...
constructor(private client: ClientService) {
    super();
  }
...
  getData(): Client[] {
    this.client.read().subscribe(
      data => {
        this.clients = data
        console.log("Data: ", this.clients)
      })
      console.log("Clientes: ", this.clients)
      return this.clients
  }
For the values I'm printing, the first console.log (Date:) prints all the data I have in the database but in the second (Clients:) prints an empty array How can I make clients always have the data?
 
    