routerProvidersHash top-level constant

const routerProvidersHash = const [const ClassProvider(LocationStrategy, useClass: HashLocationStrategy), const ClassProvider(PlatformLocation, useClass: BrowserPlatformLocation), const ClassProvider(Location), const ClassProvider(Router, useClass: RouterImpl)]

The main Router providers when using hash routing.

The routerProvidersHash should be added to the app's root injector.

@GenerateInjector([routerProvidersHash])
final InjectorFactory appInjector = ng.appInjector$Injector;
...
runApp(ng.MyAppComponentNgFactory, createInjector: appInjector);

Implementation

const routerProvidersHash = [
  ClassProvider(LocationStrategy, useClass: HashLocationStrategy),
  ClassProvider(PlatformLocation, useClass: BrowserPlatformLocation),
  ClassProvider(Location),
  ClassProvider(Router, useClass: RouterImpl)
]