How to remove hash from URL in Angular5?

与世无争的帅哥 提交于 2020-01-14 14:47:09

问题


Angular Routing(In my app-routing.module.ts)

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

In index.html I have added <base href="/">

But in the URL I can see the # My application is deployed on JBoss AS 7.1.1 Server


回答1:


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 { }


来源:https://stackoverflow.com/questions/49892407/how-to-remove-hash-from-url-in-angular5

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!