We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
In Angular 17 the tokens aren't exported anymore by @angular/ssr.
Steps to reproduce the behavior:
Expected behavior The project should be compatible with this pull request i think.
The text was updated successfully, but these errors were encountered:
You can add REQUEST and RESPONSE providers to the server.ts
commonEngine .render({ bootstrap: AppServerModule, documentFilePath: indexHtml, url:${protocol}://${headers.host}${originalUrl}, publicPath: distFolder, providers: [ {provide: APP_BASE_HREF, useValue: baseUrl}, {provide: 'REQUEST', useValue: req}, {provide: 'RESPONSE', useValue: res}, ], }) .then((html) => res.send(html)) .catch((err) => next(err));
commonEngine .render({ bootstrap: AppServerModule, documentFilePath: indexHtml, url:
, publicPath: distFolder, providers: [ {provide: APP_BASE_HREF, useValue: baseUrl}, {provide: 'REQUEST', useValue: req}, {provide: 'RESPONSE', useValue: res}, ], }) .then((html) => res.send(html)) .catch((err) => next(err));
And then in your custom DeviceDetectorService you can inject REQUEST like this @Optional() @Inject('REQUEST') request: Request
@Optional() @Inject('REQUEST') request: Request
Full example:
@Injectable() export class SsrDeviceDetectorService extends DeviceDetectorService { constructor(@Inject(PLATFORM_ID) platformId: any, @Optional() @Inject('REQUEST') request: Request) { super(platformId); if (isPlatformServer(platformId)) { super.setDeviceInfo((request.headers['user-agent'] as string) || ''); } } }
Probably only README.MD needs to be updated.
Sorry, something went wrong.
No branches or pull requests
In Angular 17 the tokens aren't exported anymore by @angular/ssr.
Steps to reproduce the behavior:
Expected behavior
The project should be compatible with this pull request i think.
The text was updated successfully, but these errors were encountered: