gpt4 book ai didi

angular - 如何从 Angular 5 中的 URL 中删除散列?

转载 作者:行者123 更新时间:2023-12-02 01:02:05 24 4
gpt4 key购买 nike

Angular 路由(在我的 app-routing.module.ts 中)

@NgModule({
exports: [ RouterModule ],
imports: [ RouterModule.forRoot(routes) ],
declarations: []
})

在 index.html 中我添加了 <base href="/">

但在 URL 中我可以看到 #我的应用程序部署在 JBoss AS 7.1.1 服务器上

最佳答案

在您的应用模块中执行此操作。在 here 中查找更多信息关于哈希定位策略。

@NgModule({
imports: [
// other imports
RouterModule.forRoot(routes, { useHash: false })
],
declarations: [
],
providers: [

],
bootstrap: [ AppComponent ]
})
export class AppModule { }

关于angular - 如何从 Angular 5 中的 URL 中删除散列?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49892407/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com