nav-params.d.ts 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /**
  2. * @description
  3. * NavParams are an object that exists on a page and can contain data for that particular view.
  4. * Similar to how data was pass to a view in V1 with `$stateParams`, NavParams offer a much more flexible
  5. * option with a simple `get` method.
  6. *
  7. * @usage
  8. * ```ts
  9. * import { NavParams } from '@ionic/angular';
  10. *
  11. * export class MyClass{
  12. *
  13. * constructor(navParams: NavParams){
  14. * // userParams is an object we have in our nav-parameters
  15. * navParams.get('userParams');
  16. * }
  17. *
  18. * }
  19. * ```
  20. */
  21. export declare class NavParams {
  22. data: {
  23. [key: string]: any;
  24. };
  25. constructor(data?: {
  26. [key: string]: any;
  27. });
  28. /**
  29. * Get the value of a nav-parameter for the current view
  30. *
  31. * ```ts
  32. * import { NavParams } from 'ionic-angular';
  33. *
  34. * export class MyClass{
  35. * constructor(public navParams: NavParams){
  36. * // userParams is an object we have in our nav-parameters
  37. * this.navParams.get('userParams');
  38. * }
  39. * }
  40. * ```
  41. *
  42. * @param param Which param you want to look up
  43. */
  44. get<T = any>(param: string): T;
  45. }