Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

225
Vistas
Angular Code Inside Subscribe() How to Run Synchronouly
_subscriptions.push(
  // Update list on OG selection
  ogViewModel.current$.subscribe(
    (group) => {
      this.groupUuid = group.ogUuid;
      this.groupId = group.id;
      this.getDevices();
      this.getSubOgs();
      this.updateGroup(group);
    },
  ),

I have a block of code inside subscribe. However, it seems that they are not executed in order. this.getSubOgs() is executed before this.getDevices(). Both are HTTP calls that returns an observable. How do I make sure this.getDevices() is executed first? Click to See Codes

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

this is basically @MishaMashina's suggestion

    _subscriptions.push(ogViewModel.current$.subscribe(
    (group) => {
      this.groupUuid = group.ogUuid;
      this.groupId = group.id;
      this.getDevices();
      this.updateGroup(group);
    },
  ),

both getDevices() and getSubOgs() remain seperate methods

in

public getDevices() { this.myApiClient.getDevices().Subscribe(
let onlyThisTime: boolean = true;
    (next) => doStuff
    (error) => doErrorStuff
    () => {if(onlyThisTime){this.getSubOgs();}}
    )}
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda