UNPKG

8.2 kBTypeScriptView Raw
1import { ComponentRef, ElementRef, EventEmitter, Renderer } from '@angular/core';
2import { NavController } from './nav-controller';
3import { NavOptions } from './nav-util';
4import { NavParams } from './nav-params';
5import { Content, Footer, Header, Navbar } from './nav-interfaces';
6/**
7 * @name ViewController
8 * @description
9 * Access various features and information about the current view.
10 * @usage
11 * ```ts
12 * import { Component } from '@angular/core';
13 * import { ViewController } from 'ionic-angular';
14 *
15 * @Component({...})
16 * export class MyPage{
17 *
18 * constructor(public viewCtrl: ViewController) {}
19 *
20 * }
21 * ```
22 */
23export declare class ViewController {
24 component: any;
25 private _cntDir;
26 private _cntRef;
27 private _ionCntDir;
28 private _ionCntRef;
29 private _hdrDir;
30 private _ftrDir;
31 private _isHidden;
32 private _leavingOpts;
33 private _nb;
34 private _onDidDismiss;
35 private _onWillDismiss;
36 private _dismissData;
37 private _dismissRole;
38 private _detached;
39 _cmp: ComponentRef<any>;
40 _nav: NavController;
41 _zIndex: number;
42 _state: number;
43 _cssClass: string;
44 _ts: number;
45 /**
46 * Observable to be subscribed to when the current component will become active
47 * @returns {Observable} Returns an observable
48 */
49 willEnter: EventEmitter<any>;
50 /**
51 * Observable to be subscribed to when the current component has become active
52 * @returns {Observable} Returns an observable
53 */
54 didEnter: EventEmitter<any>;
55 /**
56 * Observable to be subscribed to when the current component will no longer be active
57 * @returns {Observable} Returns an observable
58 */
59 willLeave: EventEmitter<any>;
60 /**
61 * Observable to be subscribed to when the current component is no long active
62 * @returns {Observable} Returns an observable
63 */
64 didLeave: EventEmitter<any>;
65 /**
66 * Observable to be subscribed to when the current component has been destroyed
67 * @returns {Observable} Returns an observable
68 */
69 willUnload: EventEmitter<any>;
70 /**
71 * @hidden
72 */
73 readReady: EventEmitter<any>;
74 /**
75 * @hidden
76 */
77 writeReady: EventEmitter<any>;
78 /** @hidden */
79 data: any;
80 /** @hidden */
81 instance: any;
82 /** @hidden */
83 id: string;
84 /** @hidden */
85 isOverlay: boolean;
86 /** @hidden */
87 private _emitter;
88 constructor(component?: any, data?: any, rootCssClass?: string);
89 /**
90 * @hidden
91 */
92 init(componentRef: ComponentRef<any>): void;
93 _setNav(navCtrl: NavController): void;
94 _setInstance(instance: any): void;
95 /**
96 * @hidden
97 */
98 subscribe(generatorOrNext?: any): any;
99 /**
100 * @hidden
101 */
102 emit(data?: any): void;
103 /**
104 * Called when the current viewController has be successfully dismissed
105 */
106 onDidDismiss(callback: (data: any, role: string) => void): void;
107 /**
108 * Called when the current viewController will be dismissed
109 */
110 onWillDismiss(callback: (data: any, role: string) => void): void;
111 /**
112 * Dismiss the current viewController
113 * @param {any} [data] Data that you want to return when the viewController is dismissed.
114 * @param {any} [role ]
115 * @param {NavOptions} navOptions Options for the dismiss navigation.
116 * @returns {any} data Returns the data passed in, if any.
117 */
118 dismiss(data?: any, role?: string, navOptions?: NavOptions): Promise<any>;
119 /**
120 * @hidden
121 */
122 getNav(): NavController;
123 /**
124 * @hidden
125 */
126 getTransitionName(_direction: string): string;
127 /**
128 * @hidden
129 */
130 getNavParams(): NavParams;
131 /**
132 * @hidden
133 */
134 setLeavingOpts(opts: NavOptions): void;
135 /**
136 * Check to see if you can go back in the navigation stack.
137 * @returns {boolean} Returns if it's possible to go back from this Page.
138 */
139 enableBack(): boolean;
140 /**
141 * @hidden
142 */
143 readonly name: string;
144 /**
145 * Get the index of the current component in the current navigation stack.
146 * @returns {number} Returns the index of this page within its `NavController`.
147 */
148 readonly index: number;
149 /**
150 * @returns {boolean} Returns if this Page is the first in the stack of pages within its NavController.
151 */
152 isFirst(): boolean;
153 /**
154 * @returns {boolean} Returns if this Page is the last in the stack of pages within its NavController.
155 */
156 isLast(): boolean;
157 /**
158 * @hidden
159 * DOM WRITE
160 */
161 _domShow(shouldShow: boolean, renderer: Renderer): void;
162 /**
163 * @hidden
164 */
165 getZIndex(): number;
166 /**
167 * @hidden
168 * DOM WRITE
169 */
170 _setZIndex(zIndex: number, renderer: Renderer): void;
171 /**
172 * @returns {ElementRef} Returns the Page's ElementRef.
173 */
174 pageRef(): ElementRef;
175 _setContent(directive: any): void;
176 /**
177 * @returns {component} Returns the Page's Content component reference.
178 */
179 getContent(): any;
180 _setContentRef(elementRef: ElementRef): void;
181 /**
182 * @returns {ElementRef} Returns the Content's ElementRef.
183 */
184 contentRef(): ElementRef;
185 _setIONContent(content: Content): void;
186 /**
187 * @hidden
188 */
189 getIONContent(): Content;
190 _setIONContentRef(elementRef: ElementRef): void;
191 /**
192 * @hidden
193 */
194 getIONContentRef(): ElementRef;
195 _setHeader(directive: Header): void;
196 /**
197 * @hidden
198 */
199 getHeader(): Header;
200 _setFooter(directive: Footer): void;
201 /**
202 * @hidden
203 */
204 getFooter(): Footer;
205 _setNavbar(directive: Navbar): void;
206 /**
207 * @hidden
208 */
209 getNavbar(): Navbar;
210 /**
211 * Find out if the current component has a NavBar or not. Be sure
212 * to wrap this in an `ionViewWillEnter` method in order to make sure
213 * the view has rendered fully.
214 * @returns {boolean} Returns a boolean if this Page has a navbar or not.
215 */
216 hasNavbar(): boolean;
217 /**
218 * Change the title of the back-button. Be sure to call this
219 * after `ionViewWillEnter` to make sure the DOM has been rendered.
220 * @param {string} val Set the back button text.
221 */
222 setBackButtonText(val: string): void;
223 /**
224 * Set if the back button for the current view is visible or not. Be sure to call this
225 * after `ionViewWillEnter` to make sure the DOM has been rendered.
226 * @param {boolean} Set if this Page's back button should show or not.
227 */
228 showBackButton(shouldShow: boolean): void;
229 _preLoad(): void;
230 /**
231 * @hidden
232 * The view has loaded. This event only happens once per view will be created.
233 * This event is fired before the component and his children have been initialized.
234 */
235 _willLoad(): void;
236 /**
237 * @hidden
238 * The view has loaded. This event only happens once per view being
239 * created. If a view leaves but is cached, then this will not
240 * fire again on a subsequent viewing. This method is a good place
241 * to put your setup code for the view; however, it is not the
242 * recommended method to use when a view becomes active.
243 */
244 _didLoad(): void;
245 /**
246 * @hidden
247 * The view is about to enter and become the active view.
248 */
249 _willEnter(): void;
250 /**
251 * @hidden
252 * The view has fully entered and is now the active view. This
253 * will fire, whether it was the first load or loaded from the cache.
254 */
255 _didEnter(): void;
256 /**
257 * @hidden
258 * The view is about to leave and no longer be the active view.
259 */
260 _willLeave(willUnload: boolean): void;
261 /**
262 * @hidden
263 * The view has finished leaving and is no longer the active view. This
264 * will fire, whether it is cached or unloaded.
265 */
266 _didLeave(): void;
267 /**
268 * @hidden
269 */
270 _willUnload(): void;
271 /**
272 * @hidden
273 * DOM WRITE
274 */
275 _destroy(renderer: Renderer): void;
276 /**
277 * @hidden
278 */
279 _lifecycleTest(lifecycle: string): Promise<boolean>;
280 /**
281 * @hidden
282 */
283 _lifecycle(lifecycle: string): void;
284}
285export declare function isViewController(viewCtrl: any): boolean;