page2.ts 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. import { Component } from '@angular/core';
  2. import { NavController, NavParams } from 'ionic-angular';
  3. @Component({
  4. selector: 'page-page2',
  5. templateUrl: 'page2.html'
  6. })
  7. export class Page2 {
  8. selectedItem: any;
  9. icons: string[];
  10. items: Array<{title: string, note: string, icon: string}>;
  11. constructor(public navCtrl: NavController, public navParams: NavParams) {
  12. // If we navigated to this page, we will have an item available as a nav param
  13. this.selectedItem = navParams.get('item');
  14. // Let's populate this page with some filler content for funzies
  15. this.icons = ['flask', 'wifi', 'beer', 'football', 'basketball', 'paper-plane',
  16. 'american-football', 'boat', 'bluetooth', 'build'];
  17. this.items = [];
  18. for (let i = 1; i < 11; i++) {
  19. this.items.push({
  20. title: 'Item ' + i,
  21. note: 'This is item #' + i,
  22. icon: this.icons[Math.floor(Math.random() * this.icons.length)]
  23. });
  24. }
  25. }
  26. itemTapped(event, item) {
  27. // That's right, we're pushing to ourselves!
  28. this.navCtrl.push(Page2, {
  29. item: item
  30. });
  31. }
  32. }