Cookies concent notice

This site uses cookies from Google to deliver its services and to analyze traffic.
Learn more
Skip to main content
Say hello to Angular's future home!Check out Angular.devHome
/

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