Closed pplaissy closed 2 weeks ago
Hi!
Say we have a standalone app
// an app config file which register a http interceptor export const appConfig: ApplicationConfig = { providers: [ provideHttpClient(withInterceptors([ apiRequestsInterceptor ])), provideAuth(authConfig) ] }; // the http interceptor export const apiRequestsInterceptor: HttpInterceptorFn = (req: HttpRequest<unknown>, next: HttpHandlerFn) => { console.log("intercepted"); // here the access token is added to headers }; // and finally a component @Component({ selector: 'test', standalone: true, imports: [], templateUrl: './test.component.html' }) export class TestComponent { }
Everything works fine until I import the Fileupload component. From this import, the interceptor is ignored.
import { FileUploadModule } from 'primeng/fileupload'; @Component({ selector: 'test', standalone: true, imports: [FileUploadModule], templateUrl: './test.component.html' }) export class TestComponent { }
It's because Fileupload imports itself HttpClientModule which is incompatible in standalone context.
I'm going to make a pull request to suggest the fix.
angular 17 standalone app
https://stackblitz.com/edit/github-7yclho?file=src%2Fapp%2Fapp.component.html
17.3.5
17.14
Angular CLI App
TypeScript
0
No response
Fixed in https://github.com/primefaces/primeng/issues/15360
Describe the bug
Hi!
Say we have a standalone app
Everything works fine until I import the Fileupload component. From this import, the interceptor is ignored.
It's because Fileupload imports itself HttpClientModule which is incompatible in standalone context.
I'm going to make a pull request to suggest the fix.
Environment
angular 17 standalone app
Reproducer
https://stackblitz.com/edit/github-7yclho?file=src%2Fapp%2Fapp.component.html
Angular version
17.3.5
PrimeNG version
17.14
Build / Runtime
Angular CLI App
Language
TypeScript
Node version (for AoT issues node --version)
0
Browser(s)
No response
Steps to reproduce the behavior
Expected behavior
No response