-
Notifications
You must be signed in to change notification settings - Fork 12k
New issue
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
@angular/ssr - how to handle responsiveness #26459
Comments
Duplicate of #26323 Worth mentioning that in some of cases relying on user-agent sniffing is a bad idea see: |
Ok, but i dont know any other solution to handle it on server... |
🥰🥰 |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Which @angular/* package(s) are the source of the bug?
core
Is this a regression?
Yes
Description
With the new version of Angular and its migration to @angular/ssr, using 'ng serve' is not based on an Express server. How can I locally work on a project, including hydration, when some components are displayed only for mobile devices and others only for desktop? Previously, I could do this by passing the user-agent to the ngx-device-detector library and obtaining information about the user's device. Unfortunately, currently on localhost I do not have the ability to check what device it is because the REQUEST and RESPONSE have a value of null. As a result, it is difficult to work on the project. How can I deal with this?
`
@if (!isMobile) {
}
@if (isMobile) {
}
Currently, on the server side, the isMobile variable will always assume a hardcoded value, e.g. true, until it receives the correct value on the browser side. This causes incompatibility, e.g. in hydration, because the DOM layout on the browser will be different from the server.
Please provide a link to a minimal reproduction of the bug
No response
Please provide the exception or error you saw
No response
Please provide the environment you discovered this bug in (run
ng version
)Anything else?
No response
The text was updated successfully, but these errors were encountered: