index.d.ts 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /**
  2. * @license Angular v19.2.13
  3. * (c) 2010-2025 Google LLC. https://angular.io/
  4. * License: MIT
  5. */
  6. import { InjectionToken, ComponentRef } from '@angular/core';
  7. import { UpgradeModule } from '@angular/upgrade/static';
  8. /**
  9. * Creates an initializer that sets up `ngRoute` integration
  10. * along with setting up the Angular router.
  11. *
  12. * @usageNotes
  13. *
  14. * For standalone applications:
  15. * ```ts
  16. * export const appConfig: ApplicationConfig = {
  17. * providers: [RouterUpgradeInitializer],
  18. * };
  19. * ```
  20. *
  21. * For NgModule based applications:
  22. * ```ts
  23. * @NgModule({
  24. * imports: [
  25. * RouterModule.forRoot(SOME_ROUTES),
  26. * UpgradeModule
  27. * ],
  28. * providers: [
  29. * RouterUpgradeInitializer
  30. * ]
  31. * })
  32. * export class AppModule {
  33. * ngDoBootstrap() {}
  34. * }
  35. * ```
  36. *
  37. * @publicApi
  38. */
  39. declare const RouterUpgradeInitializer: {
  40. provide: InjectionToken<readonly ((compRef: ComponentRef<any>) => void)[]>;
  41. multi: boolean;
  42. useFactory: (ngUpgrade: UpgradeModule) => () => void;
  43. deps: (typeof UpgradeModule)[];
  44. };
  45. /**
  46. * Sets up a location change listener to trigger `history.pushState`.
  47. * Works around the problem that `onPopState` does not trigger `history.pushState`.
  48. * Must be called *after* calling `UpgradeModule.bootstrap`.
  49. *
  50. * @param ngUpgrade The upgrade NgModule.
  51. * @param urlType The location strategy.
  52. * @see {@link /api/common/HashLocationStrategy HashLocationStrategy}
  53. * @see {@link /api/common/PathLocationStrategy PathLocationStrategy}
  54. *
  55. * @publicApi
  56. */
  57. declare function setUpLocationSync(ngUpgrade: UpgradeModule, urlType?: 'path' | 'hash'): void;
  58. export { RouterUpgradeInitializer, setUpLocationSync };