title: redirect to a route after api call in angular2
body: <p>I need to redirect the user to a different component after processing (via api) the data user submitted through form.  Below is the code I tried.</p>
  
  <p><strong>In component</strong></p>
  
  <pre><code>onSubmit(model){
    if(model.valid === true) {
      this.SharedService.postFormdata(model).subscribe(
         data  =&gt; { console.log(data)},
         error =&gt; Observable.throw(error);   
      );
      this.router.navigate(['PublicPage']);
    }
  }
  </code></pre>
  
  <p>However, after call completed, its not redirecting to <code>PublicPage</code> component. Any help please. Thanks.</p>