Skip to content

Instantly share code, notes, and snippets.

@michaelchadwick
Last active June 14, 2017 21:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save michaelchadwick/410dffc425b42a9b0315267f124b5995 to your computer and use it in GitHub Desktop.
Save michaelchadwick/410dffc425b42a9b0315267f124b5995 to your computer and use it in GitHub Desktop.
angular 2 testing - AppRouting
import { Routes, RouterModule } from '@angular/router';
import { LoginComponent } from './login/index';
import { HomeComponent } from './home/index';
import { AuthGuard } from './_guards/index';
const appRoutes: Routes = [
{ path: 'login', component: LoginComponent },
{ path: 'logout', component: LoginComponent, canActivate: [AuthGuard] },
{ path: '', component: HomeComponent, canActivate: [AuthGuard] },
// otherwise redirect to home
{ path: '**', redirectTo: '' }
];
export const routing = RouterModule.forRoot(appRoutes);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment