title: How to call function after you get data back from .subscribe() in Angular 5
body: <p>I can't seem to find an answer that works. I have an observable that I'm subscribing to like so:</p>
  
  <pre><code>this.contentfulService.weekNumber
      .subscribe(
          (weekNumber) =&gt; { this.weekNumber = weekNumber; }
      );
  </code></pre>
  
  <p>and I want to do something after the data has been received and put into my variable <code>this.weekNumber</code> I have tried doing this:</p>
  
  <pre><code>this.contentfulService.weekNumber
      .subscribe(
          (weekNumber) =&gt; { weekNumber = this.weekNumber; },
          (error) =&gt; { console.log(error); },
          () =&gt; { console.log(this.weekNumber); }
      );
  </code></pre>
  
  <p>but I'm not getting the <code>console.log</code>? Im only using the console.log as a test, I actually want to use the data that is in <code>this.weekNumber</code> to populate something but when I put it right after the <code>weekNumber = this.weekNumber</code> I get undefined so I need to be able to call a function after <code>this.weekNumber</code> has been defined</p>
  
  <p>Any help would be appreciated.</p>