Skip to content

Latest commit

 

History

History
34 lines (23 loc) · 984 Bytes

location-strategy.md

File metadata and controls

34 lines (23 loc) · 984 Bytes

Location Strategy

Angular 2 supports two kinds of routing known as location strategies.

The location strategy can be registered with ngrx/router during bootstrap, and if not specified explicitly, it will default to PathLocationStrategy.

HashLocationStrategy

Urls will appears like example.com/#/myroute

 import { provideRouter } from '@ngrx/router';
 import { HashLocationStrategy } from '@angular/common';

 bootstrap(App, [
   provideRouter(routes, HashLocationStrategy)
 ]);

PathLocationStrategy

Urls will appear like example.com/myroute

  import { provideRouter } from '@ngrx/router';
  import { PathLocationStrategy } from '@angular/common';

  bootstrap(App, [
    provideRouter(routes, PathLocationStrategy)
  ]);