UNPKG

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