nav-controller.d.ts 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. import { Location } from '@angular/common';
  2. import { NavigationExtras, Router, UrlSerializer, UrlTree } from '@angular/router';
  3. import type { AnimationBuilder, NavDirection, RouterDirection } from '@ionic/core/components';
  4. import { IonRouterOutlet } from '../directives/navigation/router-outlet';
  5. import { Platform } from './platform';
  6. import * as i0 from "@angular/core";
  7. export interface AnimationOptions {
  8. animated?: boolean;
  9. animation?: AnimationBuilder;
  10. animationDirection?: 'forward' | 'back';
  11. }
  12. export interface NavigationOptions extends NavigationExtras, AnimationOptions {
  13. }
  14. export declare class NavController {
  15. private location;
  16. private serializer;
  17. private router?;
  18. private topOutlet?;
  19. private direction;
  20. private animated?;
  21. private animationBuilder?;
  22. private guessDirection;
  23. private guessAnimation?;
  24. private lastNavId;
  25. constructor(platform: Platform, location: Location, serializer: UrlSerializer, router?: Router | undefined);
  26. /**
  27. * This method uses Angular's [Router](https://angular.io/api/router/Router) under the hood,
  28. * it's equivalent to calling `this.router.navigateByUrl()`, but it's explicit about the **direction** of the transition.
  29. *
  30. * Going **forward** means that a new page is going to be pushed to the stack of the outlet (ion-router-outlet),
  31. * and that it will show a "forward" animation by default.
  32. *
  33. * Navigating forward can also be triggered in a declarative manner by using the `[routerDirection]` directive:
  34. *
  35. * ```html
  36. * <a routerLink="/path/to/page" routerDirection="forward">Link</a>
  37. * ```
  38. */
  39. navigateForward(url: string | UrlTree | any[], options?: NavigationOptions): Promise<boolean>;
  40. /**
  41. * This method uses Angular's [Router](https://angular.io/api/router/Router) under the hood,
  42. * it's equivalent to calling:
  43. *
  44. * ```ts
  45. * this.navController.setDirection('back');
  46. * this.router.navigateByUrl(path);
  47. * ```
  48. *
  49. * Going **back** means that all the pages in the stack until the navigated page is found will be popped,
  50. * and that it will show a "back" animation by default.
  51. *
  52. * Navigating back can also be triggered in a declarative manner by using the `[routerDirection]` directive:
  53. *
  54. * ```html
  55. * <a routerLink="/path/to/page" routerDirection="back">Link</a>
  56. * ```
  57. */
  58. navigateBack(url: string | UrlTree | any[], options?: NavigationOptions): Promise<boolean>;
  59. /**
  60. * This method uses Angular's [Router](https://angular.io/api/router/Router) under the hood,
  61. * it's equivalent to calling:
  62. *
  63. * ```ts
  64. * this.navController.setDirection('root');
  65. * this.router.navigateByUrl(path);
  66. * ```
  67. *
  68. * Going **root** means that all existing pages in the stack will be removed,
  69. * and the navigated page will become the single page in the stack.
  70. *
  71. * Navigating root can also be triggered in a declarative manner by using the `[routerDirection]` directive:
  72. *
  73. * ```html
  74. * <a routerLink="/path/to/page" routerDirection="root">Link</a>
  75. * ```
  76. */
  77. navigateRoot(url: string | UrlTree | any[], options?: NavigationOptions): Promise<boolean>;
  78. /**
  79. * Same as [Location](https://angular.io/api/common/Location)'s back() method.
  80. * It will use the standard `window.history.back()` under the hood, but featuring a `back` animation
  81. * by default.
  82. */
  83. back(options?: AnimationOptions): void;
  84. /**
  85. * This methods goes back in the context of Ionic's stack navigation.
  86. *
  87. * It recursively finds the top active `ion-router-outlet` and calls `pop()`.
  88. * This is the recommended way to go back when you are using `ion-router-outlet`.
  89. *
  90. * Resolves to `true` if it was able to pop.
  91. */
  92. pop(): Promise<boolean>;
  93. /**
  94. * This methods specifies the direction of the next navigation performed by the Angular router.
  95. *
  96. * `setDirection()` does not trigger any transition, it just sets some flags to be consumed by `ion-router-outlet`.
  97. *
  98. * It's recommended to use `navigateForward()`, `navigateBack()` and `navigateRoot()` instead of `setDirection()`.
  99. */
  100. setDirection(direction: RouterDirection, animated?: boolean, animationDirection?: 'forward' | 'back', animationBuilder?: AnimationBuilder): void;
  101. /**
  102. * @internal
  103. */
  104. setTopOutlet(outlet: IonRouterOutlet): void;
  105. /**
  106. * @internal
  107. */
  108. consumeTransition(): {
  109. direction: RouterDirection;
  110. animation: NavDirection | undefined;
  111. animationBuilder: AnimationBuilder | undefined;
  112. };
  113. private navigate;
  114. static ɵfac: i0.ɵɵFactoryDeclaration<NavController, [null, null, null, { optional: true; }]>;
  115. static ɵprov: i0.ɵɵInjectableDeclaration<NavController>;
  116. }