Last active
October 25, 2022 12:02
-
-
Save NetanelBasal/546e40b6386ccadbbeb25505b111d7da to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'); | |
}, | |
}, | |
]), | |
], | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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