Skip to content

Instantly share code, notes, and snippets.

@theoomoregbee
Last active July 8, 2017 19:47
Show Gist options
  • Select an option

  • Save theoomoregbee/f867010bcf3b3c0b0bf713fe5096a0b1 to your computer and use it in GitHub Desktop.

Select an option

Save theoomoregbee/f867010bcf3b3c0b0bf713fe5096a0b1 to your computer and use it in GitHub Desktop.
EVERYTHING YOU NEED TO KNOW ON SECURING YOUR ANGULAR 2+ SPA --> Dashboard routes update
import {Routes} from "@angular/router";
import {DashboardComponent} from "./dashboard/dashboard.component";
import {HomeComponent} from "./home/home.component";
import {SettingsComponent} from "./settings/settings.component";
import {AdminComponent} from "./admin/admin.component";
import {AuthGuard} from "../guards/auth.guard";
/**
* Created by theophy on 04/06/2017.
*/
export const dashboardRoutes: Routes = [
{
path: 'dashboard', component: DashboardComponent, canActivate:[AuthGuard], canActivateChild:[AuthGuard], children: [
{path: '', redirectTo: 'home', pathMatch: 'full'},
{path: 'home', component: HomeComponent},
{path: 'settings', component: SettingsComponent},
{path: 'admin', component: AdminComponent},
]
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment