如何从Angular5中的URL中删除哈希? [英] How to remove hash from URL in Angular5?
本文介绍了如何从Angular5中的URL中删除哈希?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
角路由(在我的app-routing.module.ts中)
Angular Routing(In my app-routing.module.ts)
@NgModule({
exports: [ RouterModule ],
imports: [ RouterModule.forRoot(routes) ],
declarations: []
})
在index.html中,我添加了<base href="/">
In index.html I have added <base href="/">
但是在URL中,我可以看到#
我的应用程序已部署在JBoss AS 7.1.1 Server上
But in the URL I can see the #
My application is deployed on JBoss AS 7.1.1 Server
推荐答案
在您的应用模块中执行此操作.在此处中找到有关哈希定位策略的更多信息.
In your app module do this. Find more information in here about hash location strategy.
@NgModule({
imports: [
// other imports
RouterModule.forRoot(routes, { useHash: false })
],
declarations: [
],
providers: [
],
bootstrap: [ AppComponent ]
})
export class AppModule { }
这篇关于如何从Angular5中的URL中删除哈希?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文