wait for Http response in angular 2
<p>I am using HTTP request in angular 2. I want when I get HTTP response then next process is called.</p>

<p><strong>Example:</strong> In a <strong>form</strong> <strong>select option</strong> values are coming from <strong>HTTP get Request</strong>.I want to form page is loading until I get response for select options.</p>

<p><strong>get function</strong></p>

<pre><code>getSelectOptionValue(): any {
      let area_list_url = '/select_option_list/';

      this.urlGet(area_list_url).subscribe(
        (response) =&gt; {
          let data = response.text() ? response.json() : [{}];
          if (data) {
            Constant.areaList = data;
          }
        }
      );
    }
    return JSON.stringify(Constant.areaList);
  }
</code></pre>

<p><strong>GET function</strong></p>

<pre><code> urlGet(url: string) {

    return this._http.get(Constant.hostUrl + url, {headers: GlobalUtils.head})
      .map((res)=&gt; {
        if (res.status === 200) {
          console.log(res);
          return res;
        } else if (res.status = 201) {
          return res;
        }
      }).catch((error)=&gt; {
        console.log(error);

        if (error.status === 400) {
          return Observable.throw(new Error(error.status));
        } else if (error.status === 401) {
          return Observable.throw(new Error(error.status));
        } else if (error.status === 403) {
          return Observable.throw(new Error(error.status));
        } else if (error.status === 404) {
          return Observable.throw(new Error(error.status));
        } else if (error.status === 420) {
          return Observable.throw(new Error(error.status));
        } else {
          return Observable.throw(new Error(error.status));
        }
      });
  }
</code></pre>