title: Angular 2 function inside subscribe method getting called even before completion or request
body: <p>I am trying to get parameter from URL and then passing it to another method. Here is the code:</p>
  
  <pre><code> ngOnInit() {
      this.getParamValues();
    }
  
   getParamValues() {
      this.route.queryParams.subscribe(params =&gt; {      
          this.checkUser(params);
      });
    }
  
  
  
    checkUser(params: any) {  
  // Here this method i called twice first time with no params and second time with params
    }
  </code></pre>
  
  <p>This check Method will first check basically doing a check if user in session storage then load basic details from there else go to service. </p>
  
  <p>So problem is my checkUser method is getting called twice and I just can not put a check of that params is empty or not as there is something else i am doing except this logic. </p>
  
  <p>Is it possible that my check user method gets only called when subscribe method is done with the data not before?</p>
  
  <p>Thanks</p>