Cookies concent notice

This site uses cookies from Google to deliver its services and to analyze traffic.
Learn more
Skip to main content
This site is no longer updated.Head to Angular.devHome
/

This is the archived documentation for Angular v17. Please visit angular.dev to see this page for the current version of Angular.

withHashLocation

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

      
      withHashLocation(): RouterHashLocationFeature
    
Parameters

There are no parameters.

Returns

RouterHashLocationFeature: 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())
    ]
  }
);