title: Cancel Route Navigation from Resolver in Angular 2
body: <p>I needed to cancel the route on promise rejection and stay on the current page without redirecting to default/error page, 
  I have tried different ways of rejecting the promise but ended up resolving the route or redirected to the default route.</p>
  
  <pre><code>@Injectable()
  export class ModelResolver implements Resolve&lt;MyModel&gt; {
      constructor(private router: Router) {
      }
  
      resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Promise&lt;any&gt; {
          let params: any = route.params;
  
          let model: MyModel= new MyModel();
  
  
          return model.init().then((obj: MyModel) =&gt; {
                      return obj;
                  }).catch((err: any) =&gt; {
                      Promise.reject({message: err , ngNavigationCancelingError: true});
              });
      }
  
  }
  </code></pre>
  
  <p><code>reject({message: err , ngNavigationCancelingError: true});</code> // redirects to my default route</p>
  
  <p><code>return Observable.throw({message: err , ngNavigationCancelingError: true});</code> // redirects to the current route without cancelling</p>
  
  <p><code>resolve(null); or return Observable.empty()</code> // redirects to the current route without cancelling</p>