I create a functional guard in angular 17 import { Inject } from '@angular/core'; export const checkoutGuard: CanActivateFn = (route, state) => { const customerService = Inject(CustomerService); const router = Inject(Router); if(customerService.isAuthenticated()) { return true; } else { return router.navigateByUrl('/login'); } }; I get the error customerService.isAuthenticated is not a function. I declared the service in app.config.ts providers: [provideRouter(routes), provideHttpClient(), CustomerService,] this what iI declared in routes {path:'checkout', component:CheckoutComponent, canActivate:[checkoutGuard]} this is the service class @Injectable({ providedIn: 'root' }) export class CustomerService { isAuthenticated():boolean { return true; } } Continue reading...