简体   繁体   English

Angular 通用渲染问题

[英]Angular universal rendering issue

I have an issue via Angular universal.我有一个通过 Angular 通用的问题。 When I do the first request (http://localhost:4200) I've got the Home page, but when I'm trying to get another page (http://localhost:4200/account) I've got the Home page to, after that my app render correct component but I need to get correct page on the first request, what I'm missing?当我做第一个请求(http://localhost:4200)时,我得到了主页,但是当我试图获取另一个页面(http://localhost:4200/account)时,我得到了主页页面到,之后我的应用程序呈现正确的组件,但我需要在第一个请求时获得正确的页面,我错过了什么?

(Angular Universal don't render routes) Angular 10, Angular-universal (nodejs, express.js) - 10 (Angular Universal 不渲染路由) Angular 10,Angular-universal (nodejs, express.js) - 10

Solved by fixing CanActivate in the routing config By default, I use localStorage for saving auth info, if I have not info about auth in the localStorage navigate to the home page, the server always navigates to the home page but in the browser, I have that info通过修复路由配置中的 CanActivate 解决 默认情况下,我使用 localStorage 保存身份验证信息,如果我在 localStorage 中没有有关身份验证的信息导航到主页,服务器总是导航到主页但在浏览器中,我有那个信息

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM