Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

359
Visualizações
Angular Universal Render to Wait for Http Result Observable Subscriber

I have an Angular Universal app that calls an ASP.Net Web API service.

I have put Console writes on the Angular call to the web service (which was initiated from either a component's constructor or ngOnInit, I tried both) and the subscriber function in Typescript, as well as on the Web API method.

When running the app, I notice that the Angular Universal app does not wait for the Web API's result.

The last console write message that I get is from the Web API, not from the function in the subscriber call.

How can I force the Angular Universal app to wait for the result before finishing the render?

about 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

As long as you are using the Angular HttpClient, the server-side-render should wait for it to finish before serving your response.

If this doesn't work for you, try subscribing to the call using the | async pipe in your template code.

For example:

export class MyComponent {
  public response$ = this.httpClient.get<string>('https://my.api');

  constructor(private httpClient: HttpClient){}
}
<span> {{ response$ | async }} </span>
about 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda