title: Wait for get request - Angular 2
body: <p>I get a <strong>GET request</strong> and I would like to wait for a response to run <strong>code</strong> how do i do this?</p>
  
  <p>My code</p>
  
  <pre><code>valid()
  {
      let headers = new Headers({ 'Content-Type': 'application/json'});
      let options = new RequestOptions({ headers: headers, method: "get" }); 
      return this.http.get(this.urlstring+ "getisvalid" , options ).toPromise().then(response =&gt; response.json());
  }
  
  //Code that is in the function
  
       this._service.valid().then(resut =&gt; this.resut = resut);
  </code></pre>