title: How to execute subscribe block before other methods in Angular?
body: <p>In my service class, I have two string arrays that I'm trying to fill with data from HTTP get request with the following code:</p>
  
  <pre><code>keys: string[];
  values: string[];
  
  constructor(private entityDetailsService: LinkedEntityVocabulariesService) {
      this.getEntityDetails().subscribe(data =&gt; {
          this.keys = Object.keys(data[0]);
          this.values = Object.values(data[0]);
  
          console.log("inside subscribe: keys: " + this.keys + ", values: " + this.values);
      });
      console.log("outside subscribe: keys: " + this.keys + ", values: " + this.values);
      this.getProperties();
  }
  </code></pre>
  
  <p>and then I have a method called in the constructor, where Im trying to use those arrays:</p>
  
  <pre><code>getProperties() {
      console.log(this.keys);
      console.log(this.values);
  }
  </code></pre>
  
  <p>And I'm getting the following output in the console:
  <a href="https://i.stack.imgur.com/IETFW.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/IETFW.png" alt="enter image description here"></a></p>
  
  <p>I understand that the subscription is still being executed when <code>getProperties</code> is finished already. What I don't know, is how to make <code>getProperties</code> wait and then execute with proper data in string arrays. Can someone help me with a solution?
  I just need to get that data outside of subscribing somehow, so I can use it in the other method.</p>