a zip code crypto-currency system good for red ONLY

nav-controller.js 16KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359
  1. (function (factory) {
  2. if (typeof module === "object" && typeof module.exports === "object") {
  3. var v = factory(require, exports);
  4. if (v !== undefined) module.exports = v;
  5. }
  6. else if (typeof define === "function" && define.amd) {
  7. define(["require", "exports"], factory);
  8. }
  9. })(function (require, exports) {
  10. "use strict";
  11. Object.defineProperty(exports, "__esModule", { value: true });
  12. /**
  13. * @name NavController
  14. * @description
  15. *
  16. * NavController is the base class for navigation controller components like
  17. * [`Nav`](../../components/nav/Nav/) and [`Tab`](../../components/tabs/Tab/). You use navigation controllers
  18. * to navigate to [pages](#view-creation) in your app. At a basic level, a
  19. * navigation controller is an array of pages representing a particular history
  20. * (of a Tab for example). This array can be manipulated to navigate throughout
  21. * an app by pushing and popping pages or inserting and removing them at
  22. * arbitrary locations in history.
  23. *
  24. * The current page is the last one in the array, or the top of the stack if we
  25. * think of it that way. [Pushing](#push) a new page onto the top of the
  26. * navigation stack causes the new page to be animated in, while [popping](#pop)
  27. * the current page will navigate to the previous page in the stack.
  28. *
  29. * Unless you are using a directive like [NavPush](../../components/nav/NavPush/), or need a
  30. * specific NavController, most times you will inject and use a reference to the
  31. * nearest NavController to manipulate the navigation stack.
  32. *
  33. * ## Basic usage
  34. * The simplest way to navigate through an app is to create and initialize a new
  35. * nav controller using the `<ion-nav>` component. `ion-nav` extends the `NavController`
  36. * class.
  37. *
  38. * ```typescript
  39. * import { Component } from `@angular/core`;
  40. * import { StartPage } from './start-page';
  41. *
  42. * @Component(
  43. * template: `<ion-nav [root]="rootPage"></ion-nav>`
  44. * })
  45. * class MyApp {
  46. * // set the rootPage to the first page we want displayed
  47. * public rootPage: any = StartPage;
  48. *
  49. * constructor(){
  50. * }
  51. * }
  52. *
  53. * ```
  54. *
  55. * ### Injecting NavController
  56. * Injecting NavController will always get you an instance of the nearest
  57. * NavController, regardless of whether it is a Tab or a Nav.
  58. *
  59. * Behind the scenes, when Ionic instantiates a new NavController, it creates an
  60. * injector with NavController bound to that instance (usually either a Nav or
  61. * Tab) and adds the injector to its own providers. For more information on
  62. * providers and dependency injection, see [Dependency Injection](https://angular.io/docs/ts/latest/guide/dependency-injection.html).
  63. *
  64. * Instead, you can inject NavController and know that it is the correct
  65. * navigation controller for most situations (for more advanced situations, see
  66. * [Menu](../../menu/Menu/) and [Tab](../../tab/Tab/)).
  67. *
  68. * ```ts
  69. * import { NavController } from 'ionic-angular';
  70. *
  71. * class MyComponent {
  72. * constructor(public navCtrl: NavController) {
  73. *
  74. * }
  75. * }
  76. * ```
  77. *
  78. * ### Navigating from the Root component
  79. * What if you want to control navigation from your root app component?
  80. * You can't inject `NavController` because any components that are navigation
  81. * controllers are _children_ of the root component so they aren't available
  82. * to be injected.
  83. *
  84. * By adding a reference variable to the `ion-nav`, you can use `@ViewChild` to
  85. * get an instance of the `Nav` component, which is a navigation controller
  86. * (it extends `NavController`):
  87. *
  88. * ```typescript
  89. *
  90. * import { Component, ViewChild } from '@angular/core';
  91. * import { NavController } from 'ionic-angular';
  92. *
  93. * @Component({
  94. * template: '<ion-nav #myNav [root]="rootPage"></ion-nav>'
  95. * })
  96. * export class MyApp {
  97. * @ViewChild('myNav') nav: NavController
  98. * public rootPage: any = TabsPage;
  99. *
  100. * // Wait for the components in MyApp's template to be initialized
  101. * // In this case, we are waiting for the Nav with reference variable of "#myNav"
  102. * ngOnInit() {
  103. * // Let's navigate from TabsPage to Page1
  104. * this.nav.push(Page1);
  105. * }
  106. * }
  107. * ```
  108. *
  109. * ### Navigating from an Overlay Component
  110. * What if you wanted to navigate from an overlay component (popover, modal, alert, etc)?
  111. * In this example, we've displayed a popover in our app. From the popover, we'll get a
  112. * reference of the root `NavController` in our app, using the `getRootNav()` method.
  113. *
  114. *
  115. * ```typescript
  116. * import { Component } from '@angular/core';
  117. * import { App, ViewController } from 'ionic-angular';
  118. *
  119. * @Component({
  120. * template: `
  121. * <ion-content>
  122. * <h1>My PopoverPage</h1>
  123. * <button ion-button (click)="pushPage()">Call pushPage</button>
  124. * </ion-content>
  125. * `
  126. * })
  127. * class PopoverPage {
  128. * constructor(
  129. * public viewCtrl: ViewController
  130. * public appCtrl: App
  131. * ) {}
  132. *
  133. * pushPage() {
  134. * this.viewCtrl.dismiss();
  135. * this.appCtrl.getRootNav().push(SecondPage);
  136. * }
  137. * }
  138. *```
  139. *
  140. *
  141. * ## View creation
  142. * Views are created when they are added to the navigation stack. For methods
  143. * like [push()](#push), the NavController takes any component class that is
  144. * decorated with `@Component` as its first argument. The NavController then
  145. * compiles that component, adds it to the app and animates it into view.
  146. *
  147. * By default, pages are cached and left in the DOM if they are navigated away
  148. * from but still in the navigation stack (the exiting page on a `push()` for
  149. * example). They are destroyed when removed from the navigation stack (on
  150. * [pop()](#pop) or [setRoot()](#setRoot)).
  151. *
  152. * ## Pushing a View
  153. * To push a new view onto the navigation stack, use the `push` method.
  154. * If the page has an [`<ion-navbar>`](../../navbar/Navbar/),
  155. * a back button will automatically be added to the pushed view.
  156. *
  157. * Data can also be passed to a view by passing an object to the `push` method.
  158. * The pushed view can then receive the data by accessing it via the `NavParams`
  159. * class.
  160. *
  161. * ```typescript
  162. * import { Component } from '@angular/core';
  163. * import { NavController } from 'ionic-angular';
  164. * import { OtherPage } from './other-page';
  165. * @Component({
  166. * template: `
  167. * <ion-header>
  168. * <ion-navbar>
  169. * <ion-title>Login</ion-title>
  170. * </ion-navbar>
  171. * </ion-header>
  172. *
  173. * <ion-content>
  174. * <button ion-button (click)="pushPage()">
  175. * Go to OtherPage
  176. * </button>
  177. * </ion-content>
  178. * `
  179. * })
  180. * export class StartPage {
  181. * constructor(public navCtrl: NavController) {
  182. * }
  183. *
  184. * pushPage(){
  185. * // push another page onto the navigation stack
  186. * // causing the nav controller to transition to the new page
  187. * // optional data can also be passed to the pushed page.
  188. * this.navCtrl.push(OtherPage, {
  189. * id: "123",
  190. * name: "Carl"
  191. * });
  192. * }
  193. * }
  194. *
  195. * import { NavParams } from 'ionic-angular';
  196. *
  197. * @Component({
  198. * template: `
  199. * <ion-header>
  200. * <ion-navbar>
  201. * <ion-title>Other Page</ion-title>
  202. * </ion-navbar>
  203. * </ion-header>
  204. * <ion-content>I'm the other page!</ion-content>`
  205. * })
  206. * class OtherPage {
  207. * constructor(private navParams: NavParams) {
  208. * let id = navParams.get('id');
  209. * let name = navParams.get('name');
  210. * }
  211. * }
  212. * ```
  213. *
  214. * ## Removing a view
  215. * To remove a view from the stack, use the `pop` method.
  216. * Popping a view will transition to the previous view.
  217. *
  218. * ```ts
  219. * import { Component } from '@angular/core';
  220. * import { NavController } from 'ionic-angular';
  221. *
  222. * @Component({
  223. * template: `
  224. * <ion-header>
  225. * <ion-navbar>
  226. * <ion-title>Other Page</ion-title>
  227. * </ion-navbar>
  228. * </ion-header>
  229. * <ion-content>I'm the other page!</ion-content>`
  230. * })
  231. * class OtherPage {
  232. * constructor(public navCtrl: NavController ){
  233. * }
  234. *
  235. * popView(){
  236. * this.navCtrl.pop();
  237. * }
  238. * }
  239. * ```
  240. *
  241. * ## Lifecycle events
  242. * Lifecycle events are fired during various stages of navigation. They can be
  243. * defined in any component type which is pushed/popped from a `NavController`.
  244. *
  245. * ```ts
  246. * import { Component } from '@angular/core';
  247. *
  248. * @Component({
  249. * template: 'Hello World'
  250. * })
  251. * class HelloWorld {
  252. * ionViewDidLoad() {
  253. * console.log("I'm alive!");
  254. * }
  255. * ionViewWillLeave() {
  256. * console.log("Looks like I'm about to leave :(");
  257. * }
  258. * }
  259. * ```
  260. *
  261. * | Page Event | Returns | Description |
  262. * |---------------------|-----------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
  263. * | `ionViewDidLoad` | void | Runs when the page has loaded. This event only happens once per page being created. If a page leaves but is cached, then this event will not fire again on a subsequent viewing. The `ionViewDidLoad` event is good place to put your setup code for the page. |
  264. * | `ionViewWillEnter` | void | Runs when the page is about to enter and become the active page. |
  265. * | `ionViewDidEnter` | void | Runs when the page has fully entered and is now the active page. This event will fire, whether it was the first load or a cached page. |
  266. * | `ionViewWillLeave` | void | Runs when the page is about to leave and no longer be the active page. |
  267. * | `ionViewDidLeave` | void | Runs when the page has finished leaving and is no longer the active page. |
  268. * | `ionViewWillUnload` | void | Runs when the page is about to be destroyed and have its elements removed. |
  269. * | `ionViewCanEnter` | boolean/Promise&lt;void&gt; | Runs before the view can enter. This can be used as a sort of "guard" in authenticated views where you need to check permissions before the view can enter |
  270. * | `ionViewCanLeave` | boolean/Promise&lt;void&gt; | Runs before the view can leave. This can be used as a sort of "guard" in authenticated views where you need to check permissions before the view can leave |
  271. *
  272. *
  273. * ## Nav Guards
  274. *
  275. * In some cases, a developer should be able to control views leaving and entering. To allow for this, NavController has the `ionViewCanEnter` and `ionViewCanLeave` methods.
  276. * Similar to Angular route guards, but are more integrated with NavController. For example, if you wanted to prevent a user from leaving a view:
  277. *
  278. * ```ts
  279. * export class MyClass{
  280. * constructor(
  281. * public navCtrl: NavController
  282. * ){}
  283. *
  284. * pushPage(){
  285. * this.navCtrl.push(DetailPage);
  286. * }
  287. *
  288. * ionViewCanLeave(): boolean{
  289. * // here we can either return true or false
  290. * // depending on if we want to leave this view
  291. * if(isValid(randomValue)){
  292. * return true;
  293. * } else {
  294. * return false;
  295. * }
  296. * }
  297. * }
  298. * ```
  299. *
  300. * We need to make sure that our `navCtrl.push` has a catch in order to catch the and handle the error.
  301. * If you need to prevent a view from entering, you can do the same thing
  302. *
  303. * ```ts
  304. * export class MyClass{
  305. * constructor(
  306. * public navCtrl: NavController
  307. * ){}
  308. *
  309. * pushPage(){
  310. * this.navCtrl.push(DetailPage);
  311. * }
  312. *
  313. * }
  314. *
  315. * export class DetailPage(){
  316. * constructor(
  317. * public navCtrl: NavController
  318. * ){}
  319. * ionViewCanEnter(): boolean{
  320. * // here we can either return true or false
  321. * // depending on if we want to enter this view
  322. * if(isValid(randomValue)){
  323. * return true;
  324. * } else {
  325. * return false;
  326. * }
  327. * }
  328. * }
  329. * ```
  330. *
  331. * Similar to `ionViewCanLeave` we still need a catch on the original `navCtrl.push` in order to handle it properly.
  332. * When handling the back button in the `ion-navbar`, the catch is already taken care of for you by the framework.
  333. *
  334. * ## NavOptions
  335. *
  336. * Some methods on `NavController` allow for customizing the current transition.
  337. * To do this, we can pass an object with the modified properites.
  338. *
  339. *
  340. * | Property | Value | Description |
  341. * |-----------|-----------|------------------------------------------------------------------------------------------------------------|
  342. * | animate | `boolean` | Whether or not the transition should animate. |
  343. * | animation | `string` | What kind of animation should be used. |
  344. * | direction | `string` | The conceptual direction the user is navigating. For example, is the user navigating `forward`, or `back`? |
  345. * | duration | `number` | The length in milliseconds the animation should take. |
  346. * | easing | `string` | The easing for the animation. |
  347. *
  348. * The property 'animation' understands the following values: `md-transition`, `ios-transition` and `wp-transition`.
  349. *
  350. * @see {@link /docs/components#navigation Navigation Component Docs}
  351. */
  352. var NavController = (function () {
  353. function NavController() {
  354. }
  355. return NavController;
  356. }());
  357. exports.NavController = NavController;
  358. });
  359. //# sourceMappingURL=nav-controller.js.map