【问题标题】:remove hash from angular 8 website URL website not working if I remove simply?如果我简单地删除,从 Angular 8 网站 URL 网站中删除哈希不起作用?
【发布时间】:2020-02-09 18:24:08
【问题描述】:

我使用 Angular 8 https://newcondosgta.ca/#/开发了一个网站

当我开发它时,它没有#hash 符号,但是当我刷新页面时,它没有加载并在控制台中显示错误......但是当我分配#hash 解决方案以路由它时它工作得很好但hash 看起来不太好网站。

请建议我从 url 中删除此标志的任何解决方案...我怎样才能删除它并且它会正常工作。

谢谢

【问题讨论】:

  • 嗨,manjeet,你有没有针对这个问题找到任何解决方案。如果您以任何方式修复它,请告诉我。

标签: javascript node.js angular angular8


【解决方案1】:

在 app.module.ts 中使用 PathLocationStrategy

providers: [
// Below line is optional as default LocationStrategy is PathLocationStrategy
{provide: LocationStrategy, useClass: PathLocationStrategy} ]

问候

【讨论】:

    猜你喜欢
    • 2017-04-07
    • 2010-10-28
    • 2016-09-30
    • 2023-01-05
    • 2011-03-31
    • 2017-05-31
    • 2018-01-23
    • 1970-01-01
    相关资源
    最近更新 更多