UNPKG

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