W3cubDocs

/Angular

withHashLocation

function

Provides the location strategy that uses the URL fragment instead of the history API.

withHashLocation(): RouterConfigurationFeature

Parameters

There are no parameters.

Returns

RouterConfigurationFeature: A set of providers for use with provideRouter.

See also

Usage notes

Basic example of how you can use the hash location option:

const appRoutes: Routes = [];
bootstrapApplication(AppComponent,
  {
    providers: [
      provideRouter(appRoutes, withHashLocation())
    ]
  }
);

© 2010–2023 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
https://angular.io/api/router/withHashLocation