title: angular2 routing redirectTo when url doesn't exist
body: <p>Is there a way to redirect the user back to home page when they try to access non-existent url like /randomUrl.</p>
  
  <pre><code>export const routes: RouterConfig = [
   { path: '', component: LoginComponent },
  ];
  </code></pre>
  
  <p>I thought it would be something like the code below, but its not redirect back to the main page.</p>
  
  <pre><code>{path: '/**', redirectTo: '/', pathMatch: 'full' }
  </code></pre>
  
  <p>full route.ts</p>
  
  <pre><code>import { Component } from '@angular/core';
  import { provideRouter, RouterConfig, CanActivate } from '@angular/router';
  import { LoginComponent } from '../login/component/login';
  import { AuthGuard } from './authguard';
  import { JourneysComponent } from '../journeys/components/journeys';
  
  export const routes: RouterConfig = [
    { path: '', component: LoginComponent },
    {path:  '**', redirectTo: '/', pathMatch: 'full'},
    { path: 'journeys', component: JourneysComponent, canActivate: [AuthGuard] }
  
  ];
  
  export const APP_ROUTER_PROVIDERS = [
    provideRouter(routes)
  ];
  </code></pre>