Krishna
Krishna

Reputation: 1209

How to remove hash from URL in Angular5?

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

Upvotes: 3

Views: 3227

Answers (1)

Anuradha Gunasekara
Anuradha Gunasekara

Reputation: 6983

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

Upvotes: 1

Related Questions