import { NgModule } from '@angular/core' ; import { RouterModule , Routes } from '@angular/router' ; import { MsalGuard , MsalRedirectComponent } from '@azure/msal-angular' ; import { HomeComponent } from './pages/home/home.component' ; import { ProfileComponent } from './pages/profile/profile.component' ; const routes = [ { path : 'profile' , component : ProfileComponent , canActivate : [ MsalGuard ] } , { /**
         * Needed for login on page load for PathLocationStrategy.
         * See FAQ for details:
         * https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/lib/msal-angular/docs/FAQ.md
         */ path : 'auth' , component : MsalRedirectComponent } , { path : '' , component : HomeComponent } ] ; @ NgModule ( { imports : [ RouterModule . forRoot ( routes , { useHash : false } ) ] , exports : [ RouterModule ] } ) export class AppRoutingModule { }