Skip to content

Instantly share code, notes, and snippets.

@manoj-choudhari-git
Created May 14, 2020 20:56
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 manoj-choudhari-git/1f52568916e2971269693ad54e2100c7 to your computer and use it in GitHub Desktop.
Save manoj-choudhari-git/1f52568916e2971269693ad54e2100c7 to your computer and use it in GitHub Desktop.
App Routing Module for Azure AD B2C protected Angular App
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { HomeComponent } from './home/home.component';
import { FetchDataComponent } from './fetch-data/fetch-data.component';
import { CounterComponent } from './counter/counter.component';
import { MsalGuard } from '@azure/msal-angular';
const routes: Routes = [
{
path: '',
component: HomeComponent,
pathMatch: 'full'
},
{
path: 'counter',
component: CounterComponent,
canActivate: [
MsalGuard
]
},
{
path: 'fetch-data',
component: FetchDataComponent,
canActivate: [
MsalGuard
]
},
];
@NgModule({
imports: [RouterModule.forRoot(routes, { useHash: false })],
exports: [RouterModule]
})
export class AppRoutingModule { }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment