title: Asynchronous functions in Typescript/Angular 2
body: <p>I am having trouble when nesting two functions. The second function is executing before the first one finished. 
  I have the two methods:</p>
  
  <pre><code>doLogin() {
      return this.authService.doLogin();
  }
   toLogin(){
      this.router.navigateByUrl("/secure");
  }
  </code></pre>
  
  <p>The first function doLogin() takes awhile because of the service. How can i make the second function, toLogin() only execute after doLogin() has finished and returns true (using promises, or callbacks)?</p>
  
  <p>I am new to angular and javascript, so please be thorough in your explanation. </p>
  
  <p>Cheers!</p>