title: How to call a function after subscribe is completed
body: <p>I have this service call where im subscribing to an Observable and assigning the response to a property. My purpose is to call another function thats gonna use this property after the service call is completed. Whats the best way to do this?</p>
  <pre><code>export class MapComponent implements AfterViewInit, OnInit {
  @ViewChild(&quot;mapContainer&quot;, { static: false }) gmap: ElementRef;
  map: google.maps.Map;
  markers = [];
  
   constructor(private userService : UserService) {}
  
   ngOnInit() {
     console.log(&quot;Point 1 ##################&quot;);
     this.userService.getUserMarkers().subscribe(markers =&gt; {
        this.markers = markers;
        console.log(&quot;Point 2 ##################&quot;);
     });
   }
  
   ngAfterViewInit(): void {
     console.log(&quot;Point 3 ##################&quot;);
     this.mapInitializer();
   }
  
   mapInitializer(): void {
     console.log(&quot;Point 4 ##################&quot;);
     // function where to use the markers
   }
  </code></pre>
  <p>Now the sequence that happens is,
  Point 1 -&gt; Point 3 -&gt; Point 4 -&gt; Point 2</p>
  <p>Whats the best way to make it
  Point 1 -&gt; Point 2 -&gt; Point 3 -&gt; Point 4</p>