Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

230
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!