Skip to content

Instantly share code, notes, and snippets.

@NetanelBasal
Last active October 25, 2022 12:02
Show Gist options
  • Save NetanelBasal/546e40b6386ccadbbeb25505b111d7da to your computer and use it in GitHub Desktop.
Save NetanelBasal/546e40b6386ccadbbeb25505b111d7da to your computer and use it in GitHub Desktop.
bootstrapApplication(AppComponent, {
providers: [
provideHttpClient(
withInterceptors([
(req, next) => {
console.log('Global interceptor');
return next(req);
},
])
),
provideRouter([
{ path: '', component: HomeComponent },
{
path: 'todos',
loadChildren() {
return import('./app/todos/todos.routes');
},
},
]),
],
});
import {
provideHttpClient,
withRequestsMadeViaParent,
withInterceptors,
} from '@angular/common/http';
export default [
{
path: '',
providers: [
provideHttpClient(
// 👇👇👇👇
withRequestsMadeViaParent(),
withInterceptors([
(req, next) => {
console.log('TodosComponent Interceptors');
return next(req);
},
])
),
],
loadComponent() {
return import('./todos/todos.component');
},
},
];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment