UNPKG

1.66 kBJavaScriptView Raw
1/**
2 * @name NavParams
3 * @description
4 * NavParams are an object that exists on a page and can contain data for that particular view.
5 * Similar to how data was pass to a view in V1 with `$stateParams`, NavParams offer a much more flexible
6 * option with a simple `get` method.
7 *
8 * @usage
9 * ```ts
10 * import { NavParams } from 'ionic-angular';
11 *
12 * export class MyClass{
13 *
14 * constructor(navParams: NavParams){
15 * // userParams is an object we have in our nav-parameters
16 * navParams.get('userParams');
17 * }
18 *
19 * }
20 * ```
21 * @demo /docs/demos/src/nav-params/
22 * @see {@link /docs/components#navigation Navigation Component Docs}
23 * @see {@link ../NavController/ NavController API Docs}
24 * @see {@link /docs/api/components/nav/Nav/ Nav API Docs}
25 * @see {@link /docs/api/components/nav/NavPush/ NavPush API Docs}
26 */
27var NavParams = (function () {
28 /**
29 * @hidden
30 * @param {TODO} data TODO
31 */
32 function NavParams(data) {
33 if (data === void 0) { data = {}; }
34 this.data = data;
35 }
36 /**
37 * Get the value of a nav-parameter for the current view
38 *
39 * ```ts
40 * import { NavParams } from 'ionic-angular';
41 *
42 * export class MyClass{
43 * constructor(public navParams: NavParams){
44 * // userParams is an object we have in our nav-parameters
45 * this.navParams.get('userParams');
46 * }
47 * }
48 * ```
49 *
50 *
51 * @param {string} param Which param you want to look up
52 */
53 NavParams.prototype.get = function (param) {
54 return this.data[param];
55 };
56 return NavParams;
57}());
58export { NavParams };
59//# sourceMappingURL=nav-params.js.map
\No newline at end of file